コード例 #1
0
 @Test
 public void shouldReturnReadOnlyDerivedBuffer() {
   ChannelBuffer buf = ChannelBuffers.unmodifiableBuffer(ChannelBuffers.buffer(1));
   assertTrue(buf.duplicate() instanceof ReadOnlyChannelBuffer);
   assertTrue(buf.slice() instanceof ReadOnlyChannelBuffer);
   assertTrue(buf.slice(0, 1) instanceof ReadOnlyChannelBuffer);
   assertTrue(buf.duplicate() instanceof ReadOnlyChannelBuffer);
 }
コード例 #2
0
 @Test
 public void shouldReturnWritableCopy() {
   ChannelBuffer buf = ChannelBuffers.unmodifiableBuffer(ChannelBuffers.buffer(1));
   assertFalse(buf.copy() instanceof ReadOnlyChannelBuffer);
 }
コード例 #3
0
 @Test
 public void testUnwrap() {
   ChannelBuffer buf = ChannelBuffers.buffer(1);
   assertSame(buf, ((WrappedChannelBuffer) ChannelBuffers.unmodifiableBuffer(buf)).unwrap());
 }
コード例 #4
0
 @Test
 public void shouldHaveSameByteOrder() {
   ChannelBuffer buf = ChannelBuffers.buffer(ChannelBuffers.LITTLE_ENDIAN, 1);
   assertSame(ChannelBuffers.LITTLE_ENDIAN, ChannelBuffers.unmodifiableBuffer(buf).order());
 }
コード例 #5
0
 @Test
 public void testUnmodifiableBuffer() {
   assertTrue(
       ChannelBuffers.unmodifiableBuffer(ChannelBuffers.buffer(1))
           instanceof ReadOnlyChannelBuffer);
 }