I allocate a big bytebuffer and read in some information (not use all the space associated with this buffer).
Then I want to exactly input the used bytes into a file after filp();
what should I do.
ByteBuffer buffer = new ByteBuffer.allocate(1024);
buffer.getInt(1);
buffer.getInt(2);
buffer.flip();
for example, after above code, I just write fc.write(buffer)
?
How I tell the computer that I only need 8 bytes to input to the fc?
thanks!