Class EnhancedByteBufInputStream

  • All Implemented Interfaces:
    java.io.Closeable, java.io.DataInput, java.lang.AutoCloseable

    public class EnhancedByteBufInputStream
    extends io.netty.buffer.ByteBufInputStream
    Extends ByteBufInputStream with additional functionality.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      io.netty.buffer.ByteBuf readFully​(int length)
      Returns a ByteBuf that is a slice of the underlying ByteBuf beginning at the current reader index and having the given length.
      • Methods inherited from class io.netty.buffer.ByteBufInputStream

        available, close, mark, markSupported, read, read, readBoolean, readByte, readBytes, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, reset, skip, skipBytes
      • Methods inherited from class java.io.InputStream

        nullInputStream, read, readAllBytes, readNBytes, readNBytes, transferTo
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • EnhancedByteBufInputStream

        public EnhancedByteBufInputStream​(io.netty.buffer.ByteBuf buffer)
    • Method Detail

      • readFully

        public io.netty.buffer.ByteBuf readFully​(int length)
                                          throws java.io.IOException
        Returns a ByteBuf that is a slice of the underlying ByteBuf beginning at the current reader index and having the given length. Advances the underlying ByteBuf reader index by length. The returned ByteBuf is a slice and not a copy of the data (as opposed from ByteBufInputStream.readFully(byte[])). Any changes in the underlying buffer in this range will be reflected in the returned ByteBuf and viceversa. The returned ByteBuf will have the same ReferenceCounted.refCnt() as the underlying buffer so it is important to ByteBuf.retain() it if it must be referenced for more than the underlying buffer is.
        Parameters:
        length - The number of bytes to slice out and advance the read position by.
        Returns:
        The sliced ByteBuf.
        Throws:
        java.io.IOException - If an IOException occurred.