Interface Buffer
- 
 public interface BufferRepresents an abstract view for one or more primitive byte arrays and NIO buffers.
- 
- 
Method SummaryAll Methods Instance Methods Abstract Methods Modifier and Type Method Description intcapacity()Returns the number of bytes (octets) this buffer can contain.BuffergetBytes(int index, byte[] dst)Transfers this buffer's data to the specified destination starting at the specified absoluteindex.booleanisDirect()Returnstrueif and only if this buffer is backed by an NIO direct buffer.BuffermarkWriterIndex()Marks the current writer index in this buffer.ByteBuffernioBuffer()Exposes this buffer's readable bytes as a NIOByteBuffer.ByteBuffernioBuffer(int index, int length)Exposes this buffer's sub-region as an NIOByteBuffer.intnioBufferCount()Returns the maximum number of NIOByteBuffers that consist this buffer.ByteBuffer[]nioBuffers()Exposes this buffer's readable bytes as NIO ByteBuffer's instances.ByteBuffer[]nioBuffers(int index, int length)Exposes this buffer's readable bytes as NIO ByteBuffer's instances.intreadableBytes()Returns the number of readable bytes.booleanreadBoolean()Gets a boolean and advances the reader index.bytereadByte()Gets a byte and advances the reader index.BufferreadBytes(byte[] destination)Transfers this buffer's data to the specified destination starting at the current reader index and advances the reader index.BufferreadBytes(byte[] destination, int dstIndex, int length)Transfers this buffer's data to the specified destination starting at the current reader index and advances the reader index.BufferreadBytes(OutputStream out, int length)Transfers this buffer's data to the specified stream starting at the current reader index and advances the index.BufferreadBytes(ByteBuffer dst)Transfers this buffer's data to the specified destination starting at the current reader index until the destination's position reaches its limit, and advances the reader index.doublereadDouble()Gets a 64-bit floating point number and advances the reader index.intreaderIndex()Returns the reader index of this buffer.BufferreaderIndex(int readerIndex)Sets the reader index of this buffer.floatreadFloat()Gets a 32-bit floating point number and advances the reader index.intreadInt()Gets a 32-bit integer at the current index and advances the reader index.longreadLong()Gets a 64-bit integer and advances the reader index.shortreadShort()Gets a 16-bit short integer and advances the reader index.intreferenceCount()Returns the reference count of this object.booleanrelease()Decreases the reference count by1and deallocates this object if the reference count reaches at0.BufferresetWriterIndex()Repositions the current writer index to the marked index in this buffer.Bufferretain()Increases the reference count by1.BufferwriteBoolean(boolean value)Sets the specified boolean at the current writer index and advances the index.BufferwriteByte(int value)Sets the specified byte at the current writer index and advances the index.BufferwriteBytes(byte[] src)Transfers the specified source array's data to this buffer starting at the current writer index and advances the index.BufferwriteBytes(byte[] src, int srcIndex, int length)Transfers the specified source array's data to this buffer starting at the current writer index and advances the index.BufferwriteBytes(ByteBuffer src)Transfers the specified source byte data to this buffer starting at the current writer index and advances the index.BufferwriteDouble(double value)Sets the specified 64-bit floating point number at the current writer index and advances the index.BufferwriteFloat(float value)Sets the specified 32-bit floating point number at the current writer index and advances the index.BufferwriteInt(int value)Sets the specified 32-bit integer at the current writer index and advances the index.BufferwriteLong(long value)Sets the specified 64-bit long integer at the current writer index and advances the index.intwriterIndex()Returns the writer index of this buffer.BufferwriterIndex(int writerIndex)Sets the writer index of this buffer.BufferwriteShort(int value)Sets the specified 16-bit short integer at the current writer index and advances the index.
 
- 
- 
- 
Method Detail- 
readableBytesint readableBytes() Returns the number of readable bytes.
 - 
readerIndexint readerIndex() Returns the reader index of this buffer.
 - 
readerIndexBuffer readerIndex(int readerIndex) Sets the reader index of this buffer.- Throws:
- IndexOutOfBoundsException- if its out of bounds.
 
 - 
writerIndexint writerIndex() Returns the writer index of this buffer.
 - 
writerIndexBuffer writerIndex(int writerIndex) Sets the writer index of this buffer.
 - 
markWriterIndexBuffer markWriterIndex() Marks the current writer index in this buffer.
 - 
resetWriterIndexBuffer resetWriterIndex() Repositions the current writer index to the marked index in this buffer.
 - 
capacityint capacity() Returns the number of bytes (octets) this buffer can contain.
 - 
isDirectboolean isDirect() Returnstrueif and only if this buffer is backed by an NIO direct buffer.
 - 
readBooleanboolean readBoolean() Gets a boolean and advances the reader index.
 - 
readBytebyte readByte() Gets a byte and advances the reader index.
 - 
readShortshort readShort() Gets a 16-bit short integer and advances the reader index.
 - 
readIntint readInt() Gets a 32-bit integer at the current index and advances the reader index.
 - 
readLonglong readLong() Gets a 64-bit integer and advances the reader index.
 - 
readFloatfloat readFloat() Gets a 32-bit floating point number and advances the reader index.
 - 
readDoubledouble readDouble() Gets a 64-bit floating point number and advances the reader index.
 - 
readBytesBuffer readBytes(byte[] destination) Transfers this buffer's data to the specified destination starting at the current reader index and advances the reader index.
 - 
readBytesBuffer readBytes(byte[] destination, int dstIndex, int length) Transfers this buffer's data to the specified destination starting at the current reader index and advances the reader index.- Parameters:
- destination- The destination buffer
- dstIndex- the first index of the destination
- length- the number of bytes to transfer
 
 - 
readBytesBuffer readBytes(ByteBuffer dst) Transfers this buffer's data to the specified destination starting at the current reader index until the destination's position reaches its limit, and advances the reader index.
 - 
readBytesBuffer readBytes(OutputStream out, int length) throws IOException Transfers this buffer's data to the specified stream starting at the current reader index and advances the index.- Parameters:
- length- the number of bytes to transfer
- Throws:
- IOException- if the specified stream threw an exception during I/O
 
 - 
writeBooleanBuffer writeBoolean(boolean value) Sets the specified boolean at the current writer index and advances the index.
 - 
writeByteBuffer writeByte(int value) Sets the specified byte at the current writer index and advances the index.
 - 
writeShortBuffer writeShort(int value) Sets the specified 16-bit short integer at the current writer index and advances the index.
 - 
writeIntBuffer writeInt(int value) Sets the specified 32-bit integer at the current writer index and advances the index.
 - 
writeLongBuffer writeLong(long value) Sets the specified 64-bit long integer at the current writer index and advances the index.
 - 
writeFloatBuffer writeFloat(float value) Sets the specified 32-bit floating point number at the current writer index and advances the index.
 - 
writeDoubleBuffer writeDouble(double value) Sets the specified 64-bit floating point number at the current writer index and advances the index.
 - 
writeBytesBuffer writeBytes(byte[] src) Transfers the specified source array's data to this buffer starting at the current writer index and advances the index.
 - 
writeBytesBuffer writeBytes(ByteBuffer src) Transfers the specified source byte data to this buffer starting at the current writer index and advances the index.
 - 
writeBytesBuffer writeBytes(byte[] src, int srcIndex, int length) Transfers the specified source array's data to this buffer starting at the current writer index and advances the index.
 - 
releaseboolean release() Decreases the reference count by1and deallocates this object if the reference count reaches at0.
 - 
retainBuffer retain() Increases the reference count by1.
 - 
referenceCountint referenceCount() Returns the reference count of this object.
 - 
nioBufferCountint nioBufferCount() Returns the maximum number of NIOByteBuffers that consist this buffer.
 - 
nioBuffersByteBuffer[] nioBuffers() Exposes this buffer's readable bytes as NIO ByteBuffer's instances.
 - 
nioBuffersByteBuffer[] nioBuffers(int index, int length) Exposes this buffer's readable bytes as NIO ByteBuffer's instances.
 - 
nioBufferByteBuffer nioBuffer() Exposes this buffer's readable bytes as a NIOByteBuffer. The returned buffer either share or contains the copied content of this buffer, while changing the position and limit of the returned NIO buffer does not affect the indexes and marks of this buffer.
 - 
nioBufferByteBuffer nioBuffer(int index, int length) Exposes this buffer's sub-region as an NIOByteBuffer.
 - 
getBytesBuffer getBytes(int index, byte[] dst) Transfers this buffer's data to the specified destination starting at the specified absoluteindex. This method does not modify reader or writer indexes.
 
- 
 
-