[#1422] ReadOnlyByteBuffer.isWritable() should return false
This commit is contained in:
parent
ccd43e0cda
commit
f2d8a745b1
@ -44,6 +44,16 @@ public class ReadOnlyByteBuf extends AbstractDerivedByteBuf {
|
||||
setIndex(buffer.readerIndex(), buffer.writerIndex());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWritable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWritable(int numBytes) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ByteBuf unwrap() {
|
||||
return buffer;
|
||||
|
@ -174,4 +174,12 @@ public class ReadOnlyByteBufTest {
|
||||
public void shouldRejectSetBytes5() {
|
||||
unmodifiableBuffer(EMPTY_BUFFER).setBytes(0, (ByteBuffer) null);
|
||||
}
|
||||
|
||||
public void shouldIndicateNotWriteable() {
|
||||
assertFalse(unmodifiableBuffer(buffer(1)).isWritable());
|
||||
}
|
||||
|
||||
public void shouldIndicteNotWritableAnyNumber() {
|
||||
assertFalse(unmodifiableBuffer(buffer(1)).isWritable(1));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user