Cant seem to find the answer to this in the java docs:
Does SocketChannel.read(ByteBuffer) append or overwrite the current ByteBuffer?
The answer is in the Javadoc of ReadableByteChannel
which SocketChannel
implements:
An attempt is made to read up to r bytes from the channel, where r is the number of bytes remaining in the buffer, that is, dst.remaining(), at the moment this method is invoked.
Therefore, no, it does not overwrite.