mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-02-01 10:24:30 +07:00
Added missing assertions
This commit is contained in:
parent
2eb773633a
commit
506773d25c
@ -217,6 +217,7 @@ public class ByteInput {
|
||||
* @see ByteBuf#readSlice(int)
|
||||
*/
|
||||
public ByteInput readSlice(long numBytes) {
|
||||
assert aligned() : "not aligned";
|
||||
assert numBytes <= Integer.MAX_VALUE : "ByteBuf only supports int length";
|
||||
final int mark = updateMark(); // updates mark to start offset of slice
|
||||
final ByteBuf slice = buffer.readSlice((int) numBytes);
|
||||
|
@ -51,6 +51,7 @@ public class ByteOutput {
|
||||
}
|
||||
|
||||
public ByteOutput skipBytes(int bytes) {
|
||||
assert aligned() : "not aligned";
|
||||
incrementBitsWritten((long) bytes * Byte.SIZE);
|
||||
buffer.writeZero(bytes);
|
||||
return this;
|
||||
@ -108,6 +109,7 @@ public class ByteOutput {
|
||||
}
|
||||
|
||||
public ByteOutput writeString(CharSequence chars) {
|
||||
assert aligned() : "not aligned";
|
||||
incrementBitsWritten((long) chars.length() * Byte.SIZE);
|
||||
buffer.writeCharSequence(chars, CharsetUtil.US_ASCII);
|
||||
return this;
|
||||
|
Loading…
Reference in New Issue
Block a user