Package io.netty.buffer
Class ReadOnlyByteBufferBuf.ReadOnlyDuplicatedByteBuf
- java.lang.Object
-
- io.netty.buffer.ByteBuf
-
- io.netty.buffer.AbstractByteBuf
-
- io.netty.buffer.AbstractDerivedByteBuf
-
- io.netty.buffer.DuplicatedByteBuf
-
- io.netty.buffer.ReadOnlyByteBufferBuf.ReadOnlyDuplicatedByteBuf
-
- All Implemented Interfaces:
ByteBufConvertible,ReferenceCounted,java.lang.Comparable<ByteBuf>
- Enclosing class:
- ReadOnlyByteBufferBuf
private static final class ReadOnlyByteBufferBuf.ReadOnlyDuplicatedByteBuf extends DuplicatedByteBuf
-
-
Field Summary
-
Fields inherited from class io.netty.buffer.AbstractByteBuf
checkAccessible, leakDetector, readerIndex, writerIndex
-
-
Constructor Summary
Constructors Constructor Description ReadOnlyDuplicatedByteBuf(ByteBuf buffer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ByteBufasReadOnly()Returns a read-only version of this buffer.ByteBufduplicate()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.booleanisWritable()Returnstrueif 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.ByteBufslice(int index, int length)Returns a slice of this buffer's sub-region.-
Methods inherited from class io.netty.buffer.DuplicatedByteBuf
_getByte, _getInt, _getIntLE, _getLong, _getLongLE, _getShort, _getShortLE, _getUnsignedMedium, _getUnsignedMediumLE, _setByte, _setInt, _setIntLE, _setLong, _setLongLE, _setMedium, _setMediumLE, _setShort, _setShortLE, alloc, array, arrayOffset, capacity, capacity, copy, forEachByte, forEachByteDesc, getByte, getBytes, getBytes, getBytes, getBytes, getBytes, getBytes, getInt, getIntLE, getLong, getLongLE, getShort, getShortLE, getUnsignedMedium, getUnsignedMediumLE, hasArray, hasMemoryAddress, isDirect, memoryAddress, nioBufferCount, nioBuffers, order, setByte, setBytes, setBytes, setBytes, setBytes, setBytes, setBytes, setInt, setIntLE, setLong, setLongLE, setMedium, setMediumLE, setShort, setShortLE, unwrap
-
Methods inherited from class io.netty.buffer.AbstractDerivedByteBuf
internalNioBuffer, isAccessible, isAccessible0, isContiguous, isReadOnly, nioBuffer, refCnt, refCnt0, release, release, release0, release0, retain, retain, retain0, retain0, touch, touch, touch0, touch0
-
Methods 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, getCharSequence, 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, retainedDuplicate, 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, writeZero
-
Methods inherited from class io.netty.buffer.ByteBuf
asByteBuf, getDoubleLE, getFloatLE, maxFastWritableBytes, readDoubleLE, readFloatLE, setDoubleLE, setFloatLE, writeDoubleLE, writeFloatLE
-
-
-
-
Constructor Detail
-
ReadOnlyDuplicatedByteBuf
ReadOnlyDuplicatedByteBuf(ByteBuf buffer)
-
-
Method Detail
-
asReadOnly
public ByteBuf asReadOnly()
Description copied from class:ByteBufReturns a read-only version of this buffer.- Overrides:
asReadOnlyin classAbstractByteBuf
-
slice
public ByteBuf slice(int index, int length)
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 classDuplicatedByteBuf
-
duplicate
public ByteBuf 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 classAbstractByteBuf- 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.
-
-