Exposed ByteBuf for ByteInput and ByteOutput as a read-only view with doc

This commit is contained in:
Collin Smith 2020-08-13 18:06:54 -07:00
parent 1fcd8b7a4d
commit fda76aad7a
2 changed files with 13 additions and 2 deletions

View File

@ -73,7 +73,13 @@ public class ByteInput {
return this.bitInput = bitInput;
}
ByteBuf buffer() {
/**
* Returns a read-only view of the underlying byte buffer. This method is
* provided for debugging and testing purposes. <b>Do not use this in
* production code!</b>
*/
public ByteBuf buffer() {
assert buffer.isReadOnly();
return buffer;
}

View File

@ -25,8 +25,13 @@ public class ByteOutput {
return bitOutput != null ? bitOutput : (bitOutput = new BitOutput(this));
}
/**
* Returns a read-only view of the underlying byte buffer. This method is
* provided for debugging and testing purposes. <b>Do not use this in
* production code!</b>
*/
public ByteBuf buffer() {
return buffer;
return buffer.asReadOnly();
}
public int bytesRemaining() {