write
Writes up to the specified kapacity of bytes from the source array to this output stream.
This function blocks until the bytes are written or an exception is thrown.
Safe Bounds: The actual number of bytes written is safely clamped to prevent
IndexOutOfBoundsException. The length will be the minimum of: the requested kapacity or the available data in the source array accounting for the sourceOffset.
Parameters
The data to write.
The start offset in the source array from which to begin reading. Defaults to 0.
The maximum number of bytes to write to the stream.
Throws
If an I/O error occurs.
Appends the specified kapacity of bytes from the source array into this buffer.
Warning on Bounds: Because primitive arrays are strictly indexed by Int, writing operations are safely bounded to Int.MAX_VALUE- 8 (approximately 2.14 GB). The target end index is safely clamped to prevent IndexOutOfBoundsException if the calculated boundary exceeds the array's physical size.
Parameters
The primitive array containing the data to write.
The index in the source array to begin reading from. Defaults to 0.
The amount of data to write into this buffer.
Appends exactly the specified kapacity of bytes from the source into this buffer.
Parameters
The source to read the bytes from.
The exact amount of data to transfer into this buffer.
Throws
if the source is exhausted before the requested capacity is written.