Package io.pravega.shared.protocol.netty
Class EnhancedByteBufInputStream
- java.lang.Object
-
- java.io.InputStream
-
- io.netty.buffer.ByteBufInputStream
-
- io.pravega.shared.protocol.netty.EnhancedByteBufInputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.io.DataInput,java.lang.AutoCloseable
public class EnhancedByteBufInputStream extends io.netty.buffer.ByteBufInputStreamExtendsByteBufInputStreamwith additional functionality.
-
-
Constructor Summary
Constructors Constructor Description EnhancedByteBufInputStream(io.netty.buffer.ByteBuf buffer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description io.netty.buffer.ByteBufreadFully(int length)Returns aByteBufthat is a slice of the underlyingByteBufbeginning 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
-
-
-
-
Method Detail
-
readFully
public io.netty.buffer.ByteBuf readFully(int length) throws java.io.IOExceptionReturns aByteBufthat is a slice of the underlyingByteBufbeginning at the current reader index and having the given length. Advances the underlyingByteBufreader index by length. The returnedByteBufis a slice and not a copy of the data (as opposed fromByteBufInputStream.readFully(byte[])). Any changes in the underlying buffer in this range will be reflected in the returnedByteBufand viceversa. The returnedByteBufwill have the sameReferenceCounted.refCnt()as the underlying buffer so it is important toByteBuf.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 anIOExceptionoccurred.
-
-