You're assuming that the input is going to be exactly 300 bytes, and you're also assuming you've read it all, in a single read. You need to keep reading until read() returns -1.
I don't see any point in the object streams. They're only adding overhead. Remove them.