Package io.netty.buffer
Class ReadOnlyByteBufferBuf.ReadOnlySlicedByteBuf
java.lang.Object
io.netty.buffer.ByteBuf
io.netty.buffer.AbstractByteBuf
io.netty.buffer.AbstractDerivedByteBuf
io.netty.buffer.AbstractUnpooledSlicedByteBuf
io.netty.buffer.SlicedByteBuf
io.netty.buffer.ReadOnlyByteBufferBuf.ReadOnlySlicedByteBuf
- All Implemented Interfaces:
ByteBufConvertible,ReferenceCounted,Comparable<ByteBuf>
- Enclosing class:
ReadOnlyByteBufferBuf
-
Field Summary
Fields inherited from class io.netty.buffer.AbstractByteBuf
checkAccessible, leakDetector, readerIndex, writerIndex -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns a read-only version of this buffer.Returns a buffer which shares the whole region of this buffer.intensureWritable(int minWritableBytes, boolean force) Expands the bufferByteBuf.capacity()to make sure the number of writable bytes is equal to or greater than the specified value.booleanReturnstrueif and only if(this.capacity - this.writerIndex)is greater than0.booleanisWritable(int numBytes) Returnstrueif and only if this buffer has enough room to allow writing the specified number of elements.slice(int index, int length) Returns a slice of this buffer's sub-region.Methods inherited from class io.netty.buffer.SlicedByteBuf
capacity, initLength, lengthMethods inherited from class io.netty.buffer.AbstractUnpooledSlicedByteBuf
_getByte, _getInt, _getIntLE, _getLong, _getLongLE, _getShort, _getShortLE, _getUnsignedMedium, _getUnsignedMediumLE, _setByte, _setInt, _setIntLE, _setLong, _setLongLE, _setMedium, _setMediumLE, _setShort, _setShortLE, alloc, array, arrayOffset, capacity, checkSliceOutOfBounds, copy, forEachByte, forEachByteDesc, getByte, getBytes, getBytes, getBytes, getBytes, getBytes, getBytes, getCharSequence, getInt, getIntLE, getLong, getLongLE, getShort, getShortLE, getUnsignedMedium, getUnsignedMediumLE, hasArray, hasMemoryAddress, idx, isDirect, memoryAddress, nioBuffer, nioBufferCount, nioBuffers, order, retainedDuplicate, setByte, setBytes, setBytes, setBytes, setBytes, setBytes, setBytes, setInt, setIntLE, setLong, setLongLE, setMedium, setMediumLE, setShort, setShortLE, unwrapMethods inherited from class io.netty.buffer.AbstractDerivedByteBuf
internalNioBuffer, isAccessible, isAccessible0, isContiguous, isReadOnly, refCnt, refCnt0, release, release, release0, release0, retain, retain, retain0, retain0, touch, touch, touch0, touch0Methods inherited from class io.netty.buffer.AbstractByteBuf
adjustMarkers, bytesBefore, bytesBefore, bytesBefore, checkDstIndex, checkDstIndex, checkIndex, checkIndex, checkIndex0, checkNewCapacity, checkReadableBytes, checkSrcIndex, clear, compareTo, copy, discardMarks, discardReadBytes, discardSomeReadBytes, ensureAccessible, ensureWritable, ensureWritable0, equals, forEachByte, forEachByteAsc0, forEachByteDesc, forEachByteDesc0, getBoolean, getBytes, getBytes, getBytes, getChar, getDouble, getFloat, getMedium, getMediumLE, getUnsignedByte, getUnsignedInt, getUnsignedIntLE, getUnsignedShort, getUnsignedShortLE, hashCode, indexOf, isReadable, isReadable, markReaderIndex, markWriterIndex, maxCapacity, maxCapacity, maxWritableBytes, newSwappedByteBuf, nioBuffer, nioBuffers, order, readableBytes, readBoolean, readByte, readBytes, readBytes, readBytes, readBytes, readBytes, readBytes, readBytes, readBytes, readBytes, readBytes, readChar, readCharSequence, readDouble, readerIndex, readerIndex, readFloat, readInt, readIntLE, readLong, readLongLE, readMedium, readMediumLE, readRetainedSlice, readShort, readShortLE, readSlice, readUnsignedByte, readUnsignedInt, readUnsignedIntLE, readUnsignedMedium, readUnsignedMediumLE, readUnsignedShort, readUnsignedShortLE, resetReaderIndex, resetWriterIndex, retainedSlice, retainedSlice, setBoolean, setBytes, setBytes, setBytes, setChar, setCharSequence, setDouble, setFloat, setIndex, setIndex0, setZero, skipBytes, slice, toString, toString, toString, trimIndicesToCapacity, writableBytes, writeBoolean, writeByte, writeBytes, writeBytes, writeBytes, writeBytes, writeBytes, writeBytes, writeBytes, writeBytes, writeBytes, writeChar, writeCharSequence, writeDouble, writeFloat, writeInt, writeIntLE, writeLong, writeLongLE, writeMedium, writeMediumLE, writerIndex, writerIndex, writeShort, writeShortLE, writeZeroMethods inherited from class io.netty.buffer.ByteBuf
asByteBuf, getDoubleLE, getFloatLE, maxFastWritableBytes, readDoubleLE, readFloatLE, setDoubleLE, setFloatLE, writeDoubleLE, writeFloatLE
-
Constructor Details
-
ReadOnlySlicedByteBuf
ReadOnlySlicedByteBuf(ByteBuf buffer, int index, int length)
-
-
Method Details
-
asReadOnly
Description copied from class:ByteBufReturns a read-only version of this buffer.- Overrides:
asReadOnlyin classAbstractByteBuf
-
slice
Description copied from class:ByteBufReturns a slice of this buffer's sub-region. Modifying the content of the returned buffer or this buffer affects each other's content while they maintain separate indexes and marks. This method does not modifyreaderIndexorwriterIndexof this buffer.Also be aware that this method will NOT call
ByteBuf.retain()and so the reference count will NOT be increased.- Overrides:
slicein classAbstractUnpooledSlicedByteBuf
-
duplicate
Description copied from class:ByteBufReturns a buffer which shares the whole region of this buffer. Modifying the content of the returned buffer or this buffer affects each other's content while they maintain separate indexes and marks. This method does not modifyreaderIndexorwriterIndexof this buffer.The reader and writer marks will not be duplicated. Also be aware that this method will NOT call
ByteBuf.retain()and so the reference count will NOT be increased.- Overrides:
duplicatein classAbstractUnpooledSlicedByteBuf- Returns:
- A buffer whose readable content is equivalent to the buffer returned by
ByteBuf.slice(). However this buffer will share the capacity of the underlying buffer, and therefore allows access to all of the underlying content if necessary.
-
isWritable
public boolean isWritable()Description copied from class:ByteBufReturnstrueif and only if(this.capacity - this.writerIndex)is greater than0.- Overrides:
isWritablein classAbstractByteBuf
-
isWritable
public boolean isWritable(int numBytes) Description copied from class:ByteBufReturnstrueif and only if this buffer has enough room to allow writing the specified number of elements.- Overrides:
isWritablein classAbstractByteBuf
-
ensureWritable
public int ensureWritable(int minWritableBytes, boolean force) Description copied from class:ByteBufExpands the bufferByteBuf.capacity()to make sure the number of writable bytes is equal to or greater than the specified value. UnlikeByteBuf.ensureWritable(int), this method returns a status code.- Overrides:
ensureWritablein classAbstractByteBuf- Parameters:
minWritableBytes- the expected minimum number of writable bytesforce- WhenByteBuf.writerIndex()+minWritableBytes>ByteBuf.maxCapacity():true- the capacity of the buffer is expanded toByteBuf.maxCapacity()false- the capacity of the buffer is unchanged
- Returns:
0if the buffer has enough writable bytes, and its capacity is unchanged.1if the buffer does not have enough bytes, and its capacity is unchanged.2if the buffer has enough writable bytes, and its capacity has been increased.3if the buffer does not have enough bytes, but its capacity has been increased to its maximum.
-