InputStream/OutputStream concurrency guarantees

Florian Weimer fweimer at redhat.com
Mon Oct 27 07:50:28 UTC 2025


I assume that the buffer-based read() methods of InputStream are allowed
to write to the byte array multiple times (within the byte range that is
specified by the caller and indicated by the method result).

Similarly, the buffer-based write() methods of OutputStream are not
required to behave correctly if the byte array is concurrently modified.
They may produce a corrupted output stream, for example because a
checksum does not match the data that has been written.

Are these assumptions correct?

Thanks,
Florian



More information about the core-libs-dev mailing list