[#1422] ReadOnlyByteBuffer.isWritable() should return false

This commit is contained in:
Derek Troy-West 2013-06-05 18:55:03 +10:00 committed by Norman Maurer
parent ccd43e0cda
commit f2d8a745b1
2 changed files with 18 additions and 0 deletions

View File

@ -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;

View File

@ -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));
}
}