diff --git a/core/src/com/riiablo/io/ByteInput.java b/core/src/com/riiablo/io/ByteInput.java index 44a73338..8cb8df21 100644 --- a/core/src/com/riiablo/io/ByteInput.java +++ b/core/src/com/riiablo/io/ByteInput.java @@ -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. Do not use this in + * production code! + */ + public ByteBuf buffer() { + assert buffer.isReadOnly(); return buffer; } diff --git a/core/src/com/riiablo/io/ByteOutput.java b/core/src/com/riiablo/io/ByteOutput.java index ecdd69dd..50561a51 100644 --- a/core/src/com/riiablo/io/ByteOutput.java +++ b/core/src/com/riiablo/io/ByteOutput.java @@ -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. Do not use this in + * production code! + */ public ByteBuf buffer() { - return buffer; + return buffer.asReadOnly(); } public int bytesRemaining() {