You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the caller wants to read a ByteBuffer for reading, the offset should be 0, so that the bytes can be read from the beginning.
If the caller wants to write a ByteBuffer, the offset should be placed at the end of the input data, as if writeByteArray() was used.
Possible solutions:
Make the offset parameter mandatory
Make a parameter that indicates whether the offset should be at the beginning or the end (slightly easier to use than a mandatory offset parameter)
Make the constructor private and have ::reader() and ::writer() static factory functions
Split ByteBuffer into a ByteBufferReader and ByteBufferWriter
Separate read offset and write offset (effectively what BinaryStream was implicitly doing)
The text was updated successfully, but these errors were encountered:
If the caller wants to read a ByteBuffer for reading, the offset should be 0, so that the bytes can be read from the beginning.
If the caller wants to write a ByteBuffer, the offset should be placed at the end of the input data, as if
writeByteArray()
was used.Possible solutions:
::reader()
and::writer()
static factory functionsByteBuffer
into aByteBufferReader
andByteBufferWriter
BinaryStream
was implicitly doing)The text was updated successfully, but these errors were encountered: