Skip to content

Tag: inputstream

InputStream never gets EOF

Before anything, allow me to show you my client code: once connected to the actual socket, the client sends out some authentication data, but doesn’t recieve any data, now, it waits to recieve data from the server, and when it does, it processes it fine etc, except, when I stop the server (literally shu…

BufferInputStream vs ByteArrayInputStream

Here are three ways to read an entire file into memory before processing it: Approach A: Approach B: Approach C: Why would I prefer one approach over another? Are there any specific use-cases that call for one approach over another? Why not use a fixed-length byte[] instead? Answer Unless you need anything sp…

How to read write this in utf-8?

I was getting an error io.MalformedByteSequenceException: Invalid byte 2 of 2-byte UTF-8 sequence The solution is to read and write file in UTF-8. My code is: I’m reading a url and writing it to a file DirectionResponse.xml. Then reading DirectionResponse.xml and writing the same as *ppre_DirecionRespon…