@Test public void testRead() throws IOException { ByteBuf buf = Unpooled.buffer(12); buf.writeByte(1); buf.writeByte(2); DynamicCompositeByteBuf compositeByteBuf = new DynamicCompositeByteBuf(buf); DynamicCompositeByteBufInputStream inputStream = new DynamicCompositeByteBufInputStream(compositeByteBuf); Assert.assertTrue(inputStream != null); int b = inputStream.read(); Assert.assertTrue(b == 1); Assert.assertTrue(buf.refCnt() == 1); inputStream.close(); Assert.assertTrue(buf.refCnt() == 1); compositeByteBuf.release(); Assert.assertTrue(buf.refCnt() == 0); inputStream.close(); }
@Override public int read() throws IOException { if (!buffer.isReadable()) { return -1; } return buffer.readByte() & 0xff; }
DynamicCompositeByteBufInputStream extends InputStream implements DataInput { @Override public int read() throws IOException { if (!buffer.isReadable()) { return -1; } return buffer.readByte() & 0xff; } }
DynamicCompositeByteBufInputStream extends InputStream implements DataInput { @Override public int read() throws IOException { if (!buffer.isReadable()) { return -1; } return buffer.readByte() & 0xff; } DynamicCompositeByteBufInputStream(DynamicCompositeByteBuf compositeByteBuf);  DynamicCompositeByteBufInputStream(DynamicCompositeByteBuf buffer, boolean releaseOnClose); }
DynamicCompositeByteBufInputStream extends InputStream implements DataInput { @Override public int read() throws IOException { if (!buffer.isReadable()) { return -1; } return buffer.readByte() & 0xff; } DynamicCompositeByteBufInputStream(DynamicCompositeByteBuf compositeByteBuf);  DynamicCompositeByteBufInputStream(DynamicCompositeByteBuf buffer, boolean releaseOnClose); @Override void close(); @Override int available(); @Override boolean markSupported(); @Override int read(); @Override int read(byte[] b, int off, int len); @Override long skip(long n); int skipBytes(int n); @Override boolean readBoolean(); @Override byte readByte(); @Override char readChar(); @Override double readDouble(); @Override float readFloat(); @Override void readFully(byte[] b); @Override void readFully(byte[] b, int off, int len); @Override int readInt(); @Override String readLine(); @Override long readLong(); @Override short readShort(); @Override String readUTF(); @Override int readUnsignedByte(); @Override int readUnsignedShort(); }
DynamicCompositeByteBufInputStream extends InputStream implements DataInput { @Override public int read() throws IOException { if (!buffer.isReadable()) { return -1; } return buffer.readByte() & 0xff; } DynamicCompositeByteBufInputStream(DynamicCompositeByteBuf compositeByteBuf);  DynamicCompositeByteBufInputStream(DynamicCompositeByteBuf buffer, boolean releaseOnClose); @Override void close(); @Override int available(); @Override boolean markSupported(); @Override int read(); @Override int read(byte[] b, int off, int len); @Override long skip(long n); int skipBytes(int n); @Override boolean readBoolean(); @Override byte readByte(); @Override char readChar(); @Override double readDouble(); @Override float readFloat(); @Override void readFully(byte[] b); @Override void readFully(byte[] b, int off, int len); @Override int readInt(); @Override String readLine(); @Override long readLong(); @Override short readShort(); @Override String readUTF(); @Override int readUnsignedByte(); @Override int readUnsignedShort();  }