Looking at this standard code except for copying bytes, I'd like to know, how the streams hold their internal state.
InputStream in = new FileInputStream(...);
InputStream out = new FileOutputStream(...);
int readLength = 0;
byte[] buf = new byte[1024];
while ( (readLength = in.read(buf)) >= 0)
out.write(buf, 0, readLength);
I assume that both streams hold an internal pointer or counter to the current location in the file, that gets updated on read/write by the length of the read/written chunk. But neither the documentation nor the Oracle tutorials mention this and leave the reader to deduce on his own, that the stream starts each read/write at a "current" location. Before I start digging in OpenJDK, I thought to try asking here first.