Class ProtonAbstractBuffer
- java.lang.Object
- 
- org.apache.qpid.protonj2.buffer.ProtonAbstractBuffer
 
- 
- All Implemented Interfaces:
- java.lang.Comparable<ProtonBuffer>,- ProtonBuffer
 - Direct Known Subclasses:
- ProtonByteBuffer,- ProtonCompositeBuffer,- ProtonDuplicatedBuffer,- ProtonNioByteBuffer,- ProtonSlicedBuffer
 
 public abstract class ProtonAbstractBuffer extends java.lang.Object implements ProtonBuffer Base class used to hold the common implementation details for Proton buffer implementations.
- 
- 
Field SummaryFields Modifier and Type Field Description protected intmarkedReadIndexprotected intmarkedWriteIndexprotected intreadIndexprotected intwriteIndex
 - 
Constructor SummaryConstructors Modifier Constructor Description protectedProtonAbstractBuffer(int maximumCapacity)
 - 
Method SummaryAll Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidadjustIndexMarks(int decrement)protected voidcheckDestinationIndex(int index, int length, int dstIndex, int dstCapacity)protected voidcheckIndex(int index, int fieldLength)protected voidcheckNewCapacity(int newCapacity)protected voidcheckReadableBytes(int minimumReadableBytes)protected voidcheckSourceIndex(int index, int length, int srcIndex, int srcCapacity)ProtonBufferclear()Reset the read and write offsets to zero and clears the position markers if set previously, this method is not required to reset the data previously written to this buffer.intcompareTo(ProtonBuffer other)Compares the remaining content of the current buffer with the remaining content of the given buffer, which must not be null.ProtonBuffercopy()Create a deep copy of the readable bytes of this ProtonBuffer, the returned buffer can be modified without affecting the contents or position markers of this instance.abstract ProtonBuffercopy(int index, int length)Returns a copy of this buffer's sub-region.ProtonBufferduplicate()Create a duplicate of this ProtonBuffer instance that shares the same backing data store and but maintains separate position index values.ProtonBufferensureWritable(int minWritableBytes)Ensures that the requested number of bytes is available for write operations in the current buffer, growing the buffer if needed to meet the requested writable capacity.booleanequals(java.lang.Object other)booleangetBoolean(int index)Gets a boolean from the specified index, this method will not modify the read or write index.ProtonBuffergetBytes(int index, byte[] target)Transfers this buffer's data to the specified destination starting at the specified absoluteindex.ProtonBuffergetBytes(int index, ProtonBuffer target)Transfers this buffer's data to the specified destination starting at the specified absoluteindexuntil the destination becomes non-writable.ProtonBuffergetBytes(int index, ProtonBuffer target, int length)Transfers this buffer's data to the specified destination starting at the specified absoluteindex.chargetChar(int index)Gets a 2-byte char from the specified index, this method will not modify the read or write index.doublegetDouble(int index)Gets a double from the specified index, this method will not modify the read or write index.floatgetFloat(int index)Gets a float from the specified index, this method will not modify the read or write index.intgetMaxWritableBytes()Gets the current maximum number of bytes that can be written to this buffer.intgetReadableBytes()intgetReadIndex()shortgetUnsignedByte(int index)Gets a unsigned byte from the specified index, this method will not modify the read or write index.longgetUnsignedInt(int index)Gets a unsigned int from the specified index, this method will not modify the read or write index.intgetUnsignedShort(int index)Gets a unsigned short from the specified index, this method will not modify the read or write index.intgetWritableBytes()intgetWriteIndex()inthashCode()protected static booleanisOutOfBounds(int index, int length, int capacity)booleanisReadable()booleanisReadable(int numBytes)Check if the given number of bytes can be read from the buffer.booleanisWritable()booleanisWritable(int numBytes)Check if the requested number of bytes can be written into this buffer.ProtonBuffermarkReadIndex()Marks the current read index so that it can later be restored by a call toProtonBuffer.resetReadIndex(), the initial mark value is 0.ProtonBuffermarkWriteIndex()Marks the current write index so that it can later be restored by a call toProtonBuffer.resetWriteIndex(), the initial mark value is 0.intmaxCapacity()Returns the number of bytes that this buffer is allowed to grow to when write operations exceed the current capacity value.booleanreadBoolean()Reads a boolean value from the buffer and advances the read index by one.bytereadByte()Reads one byte from the buffer and advances the read index by one.ProtonBufferreadBytes(byte[] target)Reads bytes from this buffer and writes them into the destination byte array incrementing the read index by the value of the length of the destination array.ProtonBufferreadBytes(byte[] target, int length)Reads bytes from this buffer and writes them into the destination byte array incrementing the read index by the length value passed.ProtonBufferreadBytes(byte[] target, int offset, int length)Reads bytes from this buffer and writes them into the destination byte array incrementing the read index by the length value passed, the bytes are read into the given buffer starting from the given offset value.ProtonBufferreadBytes(java.nio.ByteBuffer dst)Transfers this buffer's data to the specified destination starting at the currentreadIndexuntil the destination's position reaches its limit, and increases thereadIndexby the number of the transferred bytes.ProtonBufferreadBytes(ProtonBuffer target)Reads bytes from this buffer and writes them into the destination ProtonBuffer incrementing the read index by the value of the number of bytes written to the target.ProtonBufferreadBytes(ProtonBuffer target, int length)Reads bytes from this buffer and writes them into the destination ProtonBuffer incrementing the read index by the number of bytes written.ProtonBufferreadBytes(ProtonBuffer target, int offset, int length)Transfers this buffer's data to the specified destination starting at the currentreadIndexand increases thereadIndexby the number of the transferred bytes (=length).doublereadDouble()Reads a double value from the buffer and advances the read index by eight.floatreadFloat()Reads a float value from the buffer and advances the read index by four.intreadInt()Reads a integer value from the buffer and advances the read index by four.longreadLong()Reads a long value from the buffer and advances the read index by eight.shortreadShort()Reads a short value from the buffer and advances the read index by two.ProtonBufferresetReadIndex()Resets the current read index to the previously marked value.ProtonBufferresetWriteIndex()Resets the current write index to the previously marked value.ProtonBuffersetBoolean(int index, boolean value)Sets the boolean value at the given write index in this buffer's backing data store.ProtonBuffersetBytes(int index, byte[] src)Transfers the specified source array's data to this buffer starting at the specified absoluteindex.ProtonBuffersetBytes(int index, ProtonBuffer source)Transfers the specified source buffer's data to this buffer starting at the specified absoluteindexuntil the source buffer becomes unreadable.ProtonBuffersetBytes(int index, ProtonBuffer source, int length)Transfers the specified source buffer's data to this buffer starting at the specified absoluteindex.ProtonBuffersetChar(int index, int value)Sets the char value at the given write index in this buffer's backing data store.ProtonBuffersetDouble(int index, double value)Sets the double value at the given write index in this buffer's backing data store.ProtonBuffersetFloat(int index, float value)Sets the float value at the given write index in this buffer's backing data store.ProtonBuffersetIndex(int readIndex, int writeIndex)Used to set the read index and the write index in one call.ProtonBuffersetReadIndex(int value)Sets the read index for this buffer.ProtonBuffersetWriteIndex(int value)Sets the write index for this buffer.ProtonBufferskipBytes(int length)Increases the currentreadIndexof this buffer by the specifiedlength.ProtonBufferslice()Create a new ProtonBuffer whose contents are a subsequence of the contents of thisProtonBuffer.ProtonBufferslice(int index, int length)Create a new ProtonBuffer whose contents are a subsequence of the contents of thisProtonBuffer.java.nio.ByteBuffertoByteBuffer()Returns a ByteBuffer that represents the readable bytes contained in this buffer.abstract java.nio.ByteBuffertoByteBuffer(int index, int length)Returns a ByteBuffer that represents the given span of bytes from the readable portion of this buffer.java.lang.StringtoString()java.lang.StringtoString(java.nio.charset.Charset charset)Returns a String created from the buffer's underlying bytes using the specifiedCharsetfor the newly created String.ProtonBufferwriteBoolean(boolean value)Writes a single boolean to the buffer and advances the write index by one.ProtonBufferwriteByte(int value)Writes a single byte to the buffer and advances the write index by one.ProtonBufferwriteBytes(byte[] source)Writes the contents of the given byte array into the buffer and advances the write index by the length of the given array.ProtonBufferwriteBytes(byte[] source, int length)Writes the contents of the given byte array into the buffer and advances the write index by the length value given.ProtonBufferwriteBytes(byte[] source, int offset, int length)Writes the contents of the given byte array into the buffer and advances the write index by the length value given.ProtonBufferwriteBytes(java.nio.ByteBuffer source)Transfers the specified source buffer's data to this buffer starting at the currentwriteIndexuntil the source buffer's position reaches its limit, and increases thewriteIndexby the number of the transferred bytes.ProtonBufferwriteBytes(ProtonBuffer source)Transfers the specified source buffer's data to this buffer starting at the currentwriteIndexuntil the source buffer becomes unreadable, and increases thewriteIndexby the number of the transferred bytes.ProtonBufferwriteBytes(ProtonBuffer source, int length)Transfers the specified source buffer's data to this buffer starting at the currentwriteIndexand increases thewriteIndexby the number of the transferred bytes (=length).ProtonBufferwriteBytes(ProtonBuffer source, int offset, int length)Transfers the specified source buffer's data to this buffer starting at the currentwriteIndexand increases thewriteIndexby the number of the transferred bytes (=length).ProtonBufferwriteDouble(double value)Writes a single double to the buffer and advances the write index by eight.ProtonBufferwriteFloat(float value)Writes a single float to the buffer and advances the write index by four.ProtonBufferwriteInt(int value)Writes a single integer to the buffer and advances the write index by four.ProtonBufferwriteLong(long value)Writes a single long to the buffer and advances the write index by eight.ProtonBufferwriteShort(short value)Writes a single short to the buffer and advances the write index by two.
 
- 
- 
- 
Method Detail- 
maxCapacitypublic int maxCapacity() Description copied from interface:ProtonBufferReturns the number of bytes that this buffer is allowed to grow to when write operations exceed the current capacity value.- Specified by:
- maxCapacityin interface- ProtonBuffer
- Returns:
- the number of bytes this buffer is allowed to grow to.
 
 - 
getReadableBytespublic int getReadableBytes() - Specified by:
- getReadableBytesin interface- ProtonBuffer
- Returns:
- the number of bytes available for reading from this buffer.
 
 - 
getWritableBytespublic int getWritableBytes() - Specified by:
- getWritableBytesin interface- ProtonBuffer
- Returns:
- the number of bytes that can be written to this buffer before the limit is hit.
 
 - 
getMaxWritableBytespublic int getMaxWritableBytes() Description copied from interface:ProtonBufferGets the current maximum number of bytes that can be written to this buffer. This is the same value that can be computed by subtracting the current write index from the maximum buffer capacity.- Specified by:
- getMaxWritableBytesin interface- ProtonBuffer
- Returns:
- the maximum number of bytes that can be written to this buffer before the limit is hit.
 
 - 
getReadIndexpublic int getReadIndex() - Specified by:
- getReadIndexin interface- ProtonBuffer
- Returns:
- the current value of the read index for this buffer.
 
 - 
setReadIndexpublic ProtonBuffer setReadIndex(int value) Description copied from interface:ProtonBufferSets the read index for this buffer.- Specified by:
- setReadIndexin interface- ProtonBuffer
- Parameters:
- value- The index into the buffer where the read index should be positioned.
- Returns:
- this buffer for use in chaining.
 
 - 
getWriteIndexpublic int getWriteIndex() - Specified by:
- getWriteIndexin interface- ProtonBuffer
- Returns:
- the current value of the write index for this buffer.
 
 - 
setWriteIndexpublic ProtonBuffer setWriteIndex(int value) Description copied from interface:ProtonBufferSets the write index for this buffer.- Specified by:
- setWriteIndexin interface- ProtonBuffer
- Parameters:
- value- The index into the buffer where the write index should be positioned.
- Returns:
- this buffer for use in chaining.
 
 - 
setIndexpublic ProtonBuffer setIndex(int readIndex, int writeIndex) Description copied from interface:ProtonBufferUsed to set the read index and the write index in one call. This methods allows for an update to the read index and write index to values that could not be set using simple setReadIndex and setWriteIndex call where the values would violate the constraints placed on them by the value of the other index.- Specified by:
- setIndexin interface- ProtonBuffer
- Parameters:
- readIndex- The new read index to assign to this buffer.
- writeIndex- The new write index to assign to this buffer.
- Returns:
- this buffer for use in chaining.
 
 - 
markReadIndexpublic ProtonBuffer markReadIndex() Description copied from interface:ProtonBufferMarks the current read index so that it can later be restored by a call toProtonBuffer.resetReadIndex(), the initial mark value is 0.- Specified by:
- markReadIndexin interface- ProtonBuffer
- Returns:
- this buffer for use in chaining.
 
 - 
resetReadIndexpublic ProtonBuffer resetReadIndex() Description copied from interface:ProtonBufferResets the current read index to the previously marked value.- Specified by:
- resetReadIndexin interface- ProtonBuffer
- Returns:
- this buffer for use in chaining.
 
 - 
markWriteIndexpublic ProtonBuffer markWriteIndex() Description copied from interface:ProtonBufferMarks the current write index so that it can later be restored by a call toProtonBuffer.resetWriteIndex(), the initial mark value is 0.- Specified by:
- markWriteIndexin interface- ProtonBuffer
- Returns:
- this buffer for use in chaining.
 
 - 
resetWriteIndexpublic ProtonBuffer resetWriteIndex() Description copied from interface:ProtonBufferResets the current write index to the previously marked value.- Specified by:
- resetWriteIndexin interface- ProtonBuffer
- Returns:
- this buffer for use in chaining.
 
 - 
isReadablepublic boolean isReadable() - Specified by:
- isReadablein interface- ProtonBuffer
- Returns:
- true if the read index is less than the write index.
 
 - 
isReadablepublic boolean isReadable(int numBytes) Description copied from interface:ProtonBufferCheck if the given number of bytes can be read from the buffer.- Specified by:
- isReadablein interface- ProtonBuffer
- Parameters:
- numBytes- the size that is desired in readable bytes
- Returns:
- true if the buffer has at least the given number of readable bytes remaining.
 
 - 
isWritablepublic boolean isWritable() - Specified by:
- isWritablein interface- ProtonBuffer
- Returns:
- true if the buffer has bytes remaining between the write index and the capacity.
 
 - 
isWritablepublic boolean isWritable(int numBytes) Description copied from interface:ProtonBufferCheck if the requested number of bytes can be written into this buffer.- Specified by:
- isWritablein interface- ProtonBuffer
- Parameters:
- numBytes- The number writable bytes that is being checked in this buffer.
- Returns:
- true if the buffer has space left for the given number of bytes to be written.
 
 - 
clearpublic ProtonBuffer clear() Description copied from interface:ProtonBufferReset the read and write offsets to zero and clears the position markers if set previously, this method is not required to reset the data previously written to this buffer.- Specified by:
- clearin interface- ProtonBuffer
- Returns:
- this buffer for using in call chaining.
 
 - 
skipBytespublic ProtonBuffer skipBytes(int length) Description copied from interface:ProtonBufferIncreases the currentreadIndexof this buffer by the specifiedlength.- Specified by:
- skipBytesin interface- ProtonBuffer
- Parameters:
- length- the number of bytes in this buffer to skip.
- Returns:
- this ProtonBuffer for chaining.
 
 - 
slicepublic ProtonBuffer slice() Description copied from interface:ProtonBufferCreate a new ProtonBuffer whose contents are a subsequence of the contents of thisProtonBuffer.The starting point of the new buffer starts at this buffer's current position, the marks and limits of the new buffer will be independent of this buffer however changes to the data backing the buffer will be visible in this buffer. - Specified by:
- slicein interface- ProtonBuffer
- Returns:
- a new ProtonBufferwhose contents are a subsequence of this buffer.
 
 - 
slicepublic ProtonBuffer slice(int index, int length) Description copied from interface:ProtonBufferCreate a new ProtonBuffer whose contents are a subsequence of the contents of thisProtonBuffer.The starting point of the new buffer starts at given index into this buffer and spans the number of bytes given by the length. Changes to the contents of this buffer or to the produced slice buffer are visible in the other. - Specified by:
- slicein interface- ProtonBuffer
- Parameters:
- index- The index in this buffer where the slice should begin.
- length- The number of bytes to make visible to the new buffer from this one.
- Returns:
- a new ProtonBufferwhose contents are a subsequence of this buffer.
 
 - 
duplicatepublic ProtonBuffer duplicate() Description copied from interface:ProtonBufferCreate a duplicate of this ProtonBuffer instance that shares the same backing data store and but maintains separate position index values. Changes to one buffer are visible in any of its duplicates. This method does not copy the read or write markers to the new buffer instance.- Specified by:
- duplicatein interface- ProtonBuffer
- Returns:
- a new ProtonBuffer instance that shares the backing data as this one.
 
 - 
copypublic ProtonBuffer copy() Description copied from interface:ProtonBufferCreate a deep copy of the readable bytes of this ProtonBuffer, the returned buffer can be modified without affecting the contents or position markers of this instance.- Specified by:
- copyin interface- ProtonBuffer
- Returns:
- a deep copy of this ProtonBuffer instance.
 
 - 
copypublic abstract ProtonBuffer copy(int index, int length) Description copied from interface:ProtonBufferReturns a copy of this buffer's sub-region. Modifying the content of the returned buffer or this buffer does not affect each other at all. This method does not modify the value returned fromProtonBuffer.getReadIndex()orProtonBuffer.getWriteIndex()of this buffer.- Specified by:
- copyin interface- ProtonBuffer
- Parameters:
- index- The index in this buffer where the copy should begin
- length- The number of bytes to copy to the new buffer from this one.
- Returns:
- a new ProtonBuffer instance containing the copied bytes.
 
 - 
toByteBufferpublic java.nio.ByteBuffer toByteBuffer() Description copied from interface:ProtonBufferReturns a ByteBuffer that represents the readable bytes contained in this buffer.This method should attempt to return a ByteBuffer that shares the backing data store with this buffer however if that is not possible it is permitted that the returned ByteBuffer contain a copy of the readable bytes of this ProtonBuffer. - Specified by:
- toByteBufferin interface- ProtonBuffer
- Returns:
- a ByteBuffer that represents the readable bytes of this buffer.
 
 - 
toByteBufferpublic abstract java.nio.ByteBuffer toByteBuffer(int index, int length)Description copied from interface:ProtonBufferReturns a ByteBuffer that represents the given span of bytes from the readable portion of this buffer.This method should attempt to return a ByteBuffer that shares the backing data store with this buffer however if that is not possible it is permitted that the returned ByteBuffer contain a copy of the readable bytes of this ProtonBuffer. - Specified by:
- toByteBufferin interface- ProtonBuffer
- Parameters:
- index- The starting index in this where the ByteBuffer view should begin.
- length- The number of bytes to include in the ByteBuffer view.
- Returns:
- a ByteBuffer that represents the given view of this buffers readable bytes.
 
 - 
ensureWritablepublic ProtonBuffer ensureWritable(int minWritableBytes) Description copied from interface:ProtonBufferEnsures that the requested number of bytes is available for write operations in the current buffer, growing the buffer if needed to meet the requested writable capacity. This method will not alter the write offset but may change the value returned from the capacity method if new buffer space is allocated.- Specified by:
- ensureWritablein interface- ProtonBuffer
- Parameters:
- minWritableBytes- The number of bytes beyond the current write index needed.
- Returns:
- this buffer for using in call chaining.
 
 - 
readBytepublic byte readByte() Description copied from interface:ProtonBufferReads one byte from the buffer and advances the read index by one.- Specified by:
- readBytein interface- ProtonBuffer
- Returns:
- a single byte from the ProtonBuffer.
 
 - 
readBooleanpublic boolean readBoolean() Description copied from interface:ProtonBufferReads a boolean value from the buffer and advances the read index by one.- Specified by:
- readBooleanin interface- ProtonBuffer
- Returns:
- boolean value read from the buffer.
 
 - 
readShortpublic short readShort() Description copied from interface:ProtonBufferReads a short value from the buffer and advances the read index by two.- Specified by:
- readShortin interface- ProtonBuffer
- Returns:
- short value read from the buffer.
 
 - 
readIntpublic int readInt() Description copied from interface:ProtonBufferReads a integer value from the buffer and advances the read index by four.- Specified by:
- readIntin interface- ProtonBuffer
- Returns:
- integer value read from the buffer.
 
 - 
readLongpublic long readLong() Description copied from interface:ProtonBufferReads a long value from the buffer and advances the read index by eight.- Specified by:
- readLongin interface- ProtonBuffer
- Returns:
- long value read from the buffer.
 
 - 
readFloatpublic float readFloat() Description copied from interface:ProtonBufferReads a float value from the buffer and advances the read index by four.- Specified by:
- readFloatin interface- ProtonBuffer
- Returns:
- float value read from the buffer.
 
 - 
readDoublepublic double readDouble() Description copied from interface:ProtonBufferReads a double value from the buffer and advances the read index by eight.- Specified by:
- readDoublein interface- ProtonBuffer
- Returns:
- double value read from the buffer.
 
 - 
readBytespublic ProtonBuffer readBytes(byte[] target) Description copied from interface:ProtonBufferReads bytes from this buffer and writes them into the destination byte array incrementing the read index by the value of the length of the destination array.- Specified by:
- readBytesin interface- ProtonBuffer
- Parameters:
- target- The byte array to write into.
- Returns:
- this ProtonBuffer for chaining.
 
 - 
readBytespublic ProtonBuffer readBytes(byte[] target, int length) Description copied from interface:ProtonBufferReads bytes from this buffer and writes them into the destination byte array incrementing the read index by the length value passed.- Specified by:
- readBytesin interface- ProtonBuffer
- Parameters:
- target- The byte array to write into.
- length- The number of bytes to read into the given array.
- Returns:
- this ProtonBuffer for chaining.
 
 - 
readBytespublic ProtonBuffer readBytes(byte[] target, int offset, int length) Description copied from interface:ProtonBufferReads bytes from this buffer and writes them into the destination byte array incrementing the read index by the length value passed, the bytes are read into the given buffer starting from the given offset value.- Specified by:
- readBytesin interface- ProtonBuffer
- Parameters:
- target- The byte array to write into.
- offset- The offset into the given array where bytes are written.
- length- The number of bytes to read into the given array.
- Returns:
- this ProtonBuffer for chaining.
 
 - 
readBytespublic ProtonBuffer readBytes(ProtonBuffer target) Description copied from interface:ProtonBufferReads bytes from this buffer and writes them into the destination ProtonBuffer incrementing the read index by the value of the number of bytes written to the target. The number of bytes written will be the equal to the writable bytes of the target buffer. The write index of the target buffer will be incremented by the number of bytes written into it.- Specified by:
- readBytesin interface- ProtonBuffer
- Parameters:
- target- The ProtonBuffer to write into.
- Returns:
- this ProtonBuffer for chaining.
 
 - 
readBytespublic ProtonBuffer readBytes(ProtonBuffer target, int length) Description copied from interface:ProtonBufferReads bytes from this buffer and writes them into the destination ProtonBuffer incrementing the read index by the number of bytes written. The write index of the target buffer will be incremented by the number of bytes written into it.- Specified by:
- readBytesin interface- ProtonBuffer
- Parameters:
- target- The ProtonBuffer to write into.
- length- The number of bytes to read into the given buffer.
- Returns:
- this ProtonBuffer for chaining.
 
 - 
readBytespublic ProtonBuffer readBytes(ProtonBuffer target, int offset, int length) Description copied from interface:ProtonBufferTransfers this buffer's data to the specified destination starting at the currentreadIndexand increases thereadIndexby the number of the transferred bytes (=length). This method does not modify the write index of the target buffer.- Specified by:
- readBytesin interface- ProtonBuffer
- Parameters:
- target- The ProtonBuffer to write into.
- offset- The offset into the given buffer where bytes are written.
- length- The number of bytes to read into the given buffer.
- Returns:
- this ProtonBuffer for chaining.
 
 - 
readBytespublic ProtonBuffer readBytes(java.nio.ByteBuffer dst) Description copied from interface:ProtonBufferTransfers this buffer's data to the specified destination starting at the currentreadIndexuntil the destination's position reaches its limit, and increases thereadIndexby the number of the transferred bytes.- Specified by:
- readBytesin interface- ProtonBuffer
- Parameters:
- dst- The target ByteBuffer to write into.
- Returns:
- this ProtonBuffer for chaining.
 
 - 
writeBytepublic ProtonBuffer writeByte(int value) Description copied from interface:ProtonBufferWrites a single byte to the buffer and advances the write index by one.- Specified by:
- writeBytein interface- ProtonBuffer
- Parameters:
- value- The byte to write into the buffer.
- Returns:
- this ProtonBuffer for chaining.
 
 - 
writeBooleanpublic ProtonBuffer writeBoolean(boolean value) Description copied from interface:ProtonBufferWrites a single boolean to the buffer and advances the write index by one.- Specified by:
- writeBooleanin interface- ProtonBuffer
- Parameters:
- value- The boolean to write into the buffer.
- Returns:
- this ProtonBuffer for chaining.
 
 - 
writeShortpublic ProtonBuffer writeShort(short value) Description copied from interface:ProtonBufferWrites a single short to the buffer and advances the write index by two.- Specified by:
- writeShortin interface- ProtonBuffer
- Parameters:
- value- The short to write into the buffer.
- Returns:
- this ProtonBuffer for chaining.
 
 - 
writeIntpublic ProtonBuffer writeInt(int value) Description copied from interface:ProtonBufferWrites a single integer to the buffer and advances the write index by four.- Specified by:
- writeIntin interface- ProtonBuffer
- Parameters:
- value- The integer to write into the buffer.
- Returns:
- this ProtonBuffer for chaining.
 
 - 
writeLongpublic ProtonBuffer writeLong(long value) Description copied from interface:ProtonBufferWrites a single long to the buffer and advances the write index by eight.- Specified by:
- writeLongin interface- ProtonBuffer
- Parameters:
- value- The long to write into the buffer.
- Returns:
- this ProtonBuffer for chaining.
 
 - 
writeFloatpublic ProtonBuffer writeFloat(float value) Description copied from interface:ProtonBufferWrites a single float to the buffer and advances the write index by four.- Specified by:
- writeFloatin interface- ProtonBuffer
- Parameters:
- value- The float to write into the buffer.
- Returns:
- this ProtonBuffer for chaining.
 
 - 
writeDoublepublic ProtonBuffer writeDouble(double value) Description copied from interface:ProtonBufferWrites a single double to the buffer and advances the write index by eight.- Specified by:
- writeDoublein interface- ProtonBuffer
- Parameters:
- value- The double to write into the buffer.
- Returns:
- this ProtonBuffer for chaining.
 
 - 
writeBytespublic ProtonBuffer writeBytes(byte[] source) Description copied from interface:ProtonBufferWrites the contents of the given byte array into the buffer and advances the write index by the length of the given array.- Specified by:
- writeBytesin interface- ProtonBuffer
- Parameters:
- source- The byte array to write into the buffer.
- Returns:
- this ProtonBuffer for chaining.
 
 - 
writeBytespublic ProtonBuffer writeBytes(byte[] source, int length) Description copied from interface:ProtonBufferWrites the contents of the given byte array into the buffer and advances the write index by the length value given.- Specified by:
- writeBytesin interface- ProtonBuffer
- Parameters:
- source- The byte array to write into the buffer.
- length- The number of bytes to write from the given array into this buffer
- Returns:
- this ProtonBuffer for chaining.
 
 - 
writeBytespublic ProtonBuffer writeBytes(byte[] source, int offset, int length) Description copied from interface:ProtonBufferWrites the contents of the given byte array into the buffer and advances the write index by the length value given. The bytes written into this buffer are read starting at the given offset into the passed in byte array.- Specified by:
- writeBytesin interface- ProtonBuffer
- Parameters:
- source- The byte array to write into the buffer.
- offset- The offset into the given array to start reading from.
- length- The number of bytes to write from the given array into this buffer
- Returns:
- this ProtonBuffer for chaining.
 
 - 
writeBytespublic ProtonBuffer writeBytes(ProtonBuffer source) Description copied from interface:ProtonBufferTransfers the specified source buffer's data to this buffer starting at the currentwriteIndexuntil the source buffer becomes unreadable, and increases thewriteIndexby the number of the transferred bytes. This method is basically same withProtonBuffer.writeBytes(ProtonBuffer, int, int), except that this method increases thereadIndexof the source buffer by the number of the transferred bytes whileProtonBuffer.writeBytes(ProtonBuffer, int, int)does not.- Specified by:
- writeBytesin interface- ProtonBuffer
- Parameters:
- source- The source buffer from which the bytes are read.
- Returns:
- this ProtonBuffer for chaining.
 
 - 
writeBytespublic ProtonBuffer writeBytes(ProtonBuffer source, int length) Description copied from interface:ProtonBufferTransfers the specified source buffer's data to this buffer starting at the currentwriteIndexand increases thewriteIndexby the number of the transferred bytes (=length). This method is basically same withProtonBuffer.writeBytes(ProtonBuffer, int, int), except that this method increases thereadIndexof the source buffer by the number of the transferred bytes (=length) whileProtonBuffer.writeBytes(ProtonBuffer, int, int)does not.- Specified by:
- writeBytesin interface- ProtonBuffer
- Parameters:
- source- The source buffer from which the bytes are read.
- length- The number of bytes to transfer
- Returns:
- this buffer for chaining
 
 - 
writeBytespublic ProtonBuffer writeBytes(ProtonBuffer source, int offset, int length) Description copied from interface:ProtonBufferTransfers the specified source buffer's data to this buffer starting at the currentwriteIndexand increases thewriteIndexby the number of the transferred bytes (=length). This method does not modify the read index of the source buffer.- Specified by:
- writeBytesin interface- ProtonBuffer
- Parameters:
- source- The source buffer from which the bytes are read.
- offset- The offset in the source buffer to start writing into this buffer.
- length- The number of bytes to transfer
- Returns:
- this buffer for chaining
 
 - 
writeBytespublic ProtonBuffer writeBytes(java.nio.ByteBuffer source) Description copied from interface:ProtonBufferTransfers the specified source buffer's data to this buffer starting at the currentwriteIndexuntil the source buffer's position reaches its limit, and increases thewriteIndexby the number of the transferred bytes.- Specified by:
- writeBytesin interface- ProtonBuffer
- Parameters:
- source- The source buffer from which the bytes are read.
- Returns:
- this buffer for chaining
 
 - 
getBooleanpublic boolean getBoolean(int index) Description copied from interface:ProtonBufferGets a boolean from the specified index, this method will not modify the read or write index.- Specified by:
- getBooleanin interface- ProtonBuffer
- Parameters:
- index- The index into the buffer where the value should be read.
- Returns:
- the value read from the given index.
 
 - 
getUnsignedBytepublic short getUnsignedByte(int index) Description copied from interface:ProtonBufferGets a unsigned byte from the specified index, this method will not modify the read or write index.- Specified by:
- getUnsignedBytein interface- ProtonBuffer
- Parameters:
- index- The index into the buffer where the value should be read.
- Returns:
- the value read from the given index.
 
 - 
getUnsignedShortpublic int getUnsignedShort(int index) Description copied from interface:ProtonBufferGets a unsigned short from the specified index, this method will not modify the read or write index.- Specified by:
- getUnsignedShortin interface- ProtonBuffer
- Parameters:
- index- The index into the buffer where the value should be read.
- Returns:
- the value read from the given index.
 
 - 
getUnsignedIntpublic long getUnsignedInt(int index) Description copied from interface:ProtonBufferGets a unsigned int from the specified index, this method will not modify the read or write index.- Specified by:
- getUnsignedIntin interface- ProtonBuffer
- Parameters:
- index- The index into the buffer where the value should be read.
- Returns:
- the value read from the given index.
 
 - 
getCharpublic char getChar(int index) Description copied from interface:ProtonBufferGets a 2-byte char from the specified index, this method will not modify the read or write index.- Specified by:
- getCharin interface- ProtonBuffer
- Parameters:
- index- The index into the buffer where the value should be read.
- Returns:
- the value read from the given index.
 
 - 
getFloatpublic float getFloat(int index) Description copied from interface:ProtonBufferGets a float from the specified index, this method will not modify the read or write index.- Specified by:
- getFloatin interface- ProtonBuffer
- Parameters:
- index- The index into the buffer where the value should be read.
- Returns:
- the value read from the given index.
 
 - 
getDoublepublic double getDouble(int index) Description copied from interface:ProtonBufferGets a double from the specified index, this method will not modify the read or write index.- Specified by:
- getDoublein interface- ProtonBuffer
- Parameters:
- index- The index into the buffer where the value should be read.
- Returns:
- the value read from the given index.
 
 - 
getBytespublic ProtonBuffer getBytes(int index, byte[] target) Description copied from interface:ProtonBufferTransfers this buffer's data to the specified destination starting at the specified absoluteindex. This method does not modifyreadIndexorwriteIndexof this buffer- Specified by:
- getBytesin interface- ProtonBuffer
- Parameters:
- index- The index into the buffer where the value should be read.
- target- The buffer where the bytes read will be written to
- Returns:
- this buffer for chaining
 
 - 
getBytespublic ProtonBuffer getBytes(int index, ProtonBuffer target) Description copied from interface:ProtonBufferTransfers this buffer's data to the specified destination starting at the specified absoluteindexuntil the destination becomes non-writable. This method is basically same withProtonBuffer.getBytes(int, ProtonBuffer, int, int), except that this method increases thewriteIndexof the destination by the number of the transferred bytes whileProtonBuffer.getBytes(int, ProtonBuffer, int, int)does not. This method does not modifyreadIndexorwriteIndexof the source buffer (i.e.this).- Specified by:
- getBytesin interface- ProtonBuffer
- Parameters:
- index- The index into the buffer where the value should be read.
- target- the destination buffer for the bytes to be read
- Returns:
- this buffer for chaining
 
 - 
getBytespublic ProtonBuffer getBytes(int index, ProtonBuffer target, int length) Description copied from interface:ProtonBufferTransfers this buffer's data to the specified destination starting at the specified absoluteindex. This method is basically same withProtonBuffer.getBytes(int, ProtonBuffer, int, int), except that this method increases thewriteIndexof the destination by the number of the transferred bytes whileProtonBuffer.getBytes(int, ProtonBuffer, int, int)does not. This method does not modifyreadIndexorwriteIndexof the source buffer (i.e.this).- Specified by:
- getBytesin interface- ProtonBuffer
- Parameters:
- index- the index in the buffer to start the read from
- target- the destination buffer for the bytes to be read
- length- the number of bytes to transfer
- Returns:
- this buffer for chaining
 
 - 
setBooleanpublic ProtonBuffer setBoolean(int index, boolean value) Description copied from interface:ProtonBufferSets the boolean value at the given write index in this buffer's backing data store.- Specified by:
- setBooleanin interface- ProtonBuffer
- Parameters:
- index- The index to start the write from.
- value- The value to write at the given index.
- Returns:
- a reference to this ProtonBuffer for chaining.
 
 - 
setCharpublic ProtonBuffer setChar(int index, int value) Description copied from interface:ProtonBufferSets the char value at the given write index in this buffer's backing data store.- Specified by:
- setCharin interface- ProtonBuffer
- Parameters:
- index- The index to start the write from.
- value- The value to write at the given index.
- Returns:
- a reference to this ProtonBuffer for chaining.
 
 - 
setFloatpublic ProtonBuffer setFloat(int index, float value) Description copied from interface:ProtonBufferSets the float value at the given write index in this buffer's backing data store.- Specified by:
- setFloatin interface- ProtonBuffer
- Parameters:
- index- The index to start the write from.
- value- The value to write at the given index.
- Returns:
- a reference to this ProtonBuffer for chaining.
 
 - 
setDoublepublic ProtonBuffer setDouble(int index, double value) Description copied from interface:ProtonBufferSets the double value at the given write index in this buffer's backing data store.- Specified by:
- setDoublein interface- ProtonBuffer
- Parameters:
- index- The index to start the write from.
- value- The value to write at the given index.
- Returns:
- a reference to this ProtonBuffer for chaining.
 
 - 
setBytespublic ProtonBuffer setBytes(int index, byte[] src) Description copied from interface:ProtonBufferTransfers the specified source array's data to this buffer starting at the specified absoluteindex. This method does not modifyreadIndexorwriteIndexof this buffer.- Specified by:
- setBytesin interface- ProtonBuffer
- Parameters:
- index- The index in this buffer where the write operation starts.
- src- The source buffer from which the bytes are read.
- Returns:
- this buffer for chaining
 
 - 
setBytespublic ProtonBuffer setBytes(int index, ProtonBuffer source) Description copied from interface:ProtonBufferTransfers the specified source buffer's data to this buffer starting at the specified absoluteindexuntil the source buffer becomes unreadable. This method is basically same withProtonBuffer.setBytes(int, ProtonBuffer, int, int), except that this method increases thereadIndexof the source buffer by the number of the transferred bytes whileProtonBuffer.setBytes(int, ProtonBuffer, int, int)does not. This method does not modifyreadIndexorwriteIndexof the source buffer (i.e.this).- Specified by:
- setBytesin interface- ProtonBuffer
- Parameters:
- index- The index in this buffer where the write operation starts.
- source- The source buffer from which the bytes are read.
- Returns:
- this buffer for chaining
 
 - 
setBytespublic ProtonBuffer setBytes(int index, ProtonBuffer source, int length) Description copied from interface:ProtonBufferTransfers the specified source buffer's data to this buffer starting at the specified absoluteindex. This method is basically same withProtonBuffer.setBytes(int, ProtonBuffer, int, int), except that this method increases thereadIndexof the source buffer by the number of the transferred bytes whileProtonBuffer.setBytes(int, ProtonBuffer, int, int)does not. This method does not modifyreadIndexorwriteIndexof the source buffer (i.e.this).- Specified by:
- setBytesin interface- ProtonBuffer
- Parameters:
- index- The index in this buffer where the write operation starts.
- source- The source buffer from which the bytes are read.
- length- The number of bytes to transfer
- Returns:
- this buffer for chaining
 
 - 
hashCodepublic int hashCode() - Overrides:
- hashCodein class- java.lang.Object
 
 - 
equalspublic boolean equals(java.lang.Object other) - Overrides:
- equalsin class- java.lang.Object
 
 - 
compareTopublic int compareTo(ProtonBuffer other) Description copied from interface:ProtonBufferCompares the remaining content of the current buffer with the remaining content of the given buffer, which must not be null. Each byte is compared in turn as an unsigned value, returning upon the first difference. If no difference is found before the end of one buffer, the shorter buffer is considered less than the other, or else if the same length then they are considered equal.- Specified by:
- compareToin interface- java.lang.Comparable<ProtonBuffer>
- Specified by:
- compareToin interface- ProtonBuffer
- Returns:
- a negative, zero, or positive integer when this buffer is less than, equal to, or greater than the given buffer.
- See Also:
- Comparable.compareTo(Object)
 
 - 
toStringpublic java.lang.String toString() - Overrides:
- toStringin class- java.lang.Object
 
 - 
toStringpublic java.lang.String toString(java.nio.charset.Charset charset) Description copied from interface:ProtonBufferReturns a String created from the buffer's underlying bytes using the specifiedCharsetfor the newly created String.- Specified by:
- toStringin interface- ProtonBuffer
- Parameters:
- charset- the- Charsetto use to construct the new string.
- Returns:
- a string created from the buffer's underlying bytes using the given Charset.
 
 - 
checkNewCapacityprotected final void checkNewCapacity(int newCapacity) 
 - 
isOutOfBoundsprotected static boolean isOutOfBounds(int index, int length, int capacity)
 - 
checkIndexprotected final void checkIndex(int index, int fieldLength)
 - 
checkSourceIndexprotected final void checkSourceIndex(int index, int length, int srcIndex, int srcCapacity)
 - 
checkDestinationIndexprotected final void checkDestinationIndex(int index, int length, int dstIndex, int dstCapacity)
 - 
checkReadableBytesprotected final void checkReadableBytes(int minimumReadableBytes) 
 - 
adjustIndexMarksprotected final void adjustIndexMarks(int decrement) 
 
- 
 
-