Fixed another two contract violations in AbstractChannelBuffer
This commit is contained in:
parent
d882e4f27c
commit
0a594a27d5
@ -310,6 +310,9 @@ public abstract class AbstractChannelBuffer implements ChannelBuffer {
|
||||
}
|
||||
|
||||
public void readBytes(ChannelBuffer dst, int length) {
|
||||
if (length > dst.writableBytes()) {
|
||||
throw new IndexOutOfBoundsException();
|
||||
}
|
||||
readBytes(dst, dst.writerIndex(), length);
|
||||
dst.writerIndex(dst.writerIndex() + length);
|
||||
}
|
||||
@ -397,6 +400,9 @@ public abstract class AbstractChannelBuffer implements ChannelBuffer {
|
||||
}
|
||||
|
||||
public void writeBytes(ChannelBuffer src, int length) {
|
||||
if (length > src.readableBytes()) {
|
||||
throw new IndexOutOfBoundsException();
|
||||
}
|
||||
writeBytes(src, src.readerIndex(), length);
|
||||
src.readerIndex(src.readerIndex() + length);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user