Class AbstractIoBuffer

  • All Implemented Interfaces:
    java.lang.Comparable<IoBuffer>

    public abstract class AbstractIoBuffer
    extends IoBuffer
    A base implementation of IoBuffer. This implementation assumes that IoBuffer.buf() always returns a correct NIO ByteBuffer instance. Most implementations could extend this class and implement their own buffer management mechanism.
    Author:
    Apache MINA Project
    See Also:
    IoBufferAllocator
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      java.nio.CharBuffer asCharBuffer()
      java.nio.DoubleBuffer asDoubleBuffer()
      java.nio.FloatBuffer asFloatBuffer()
      java.io.InputStream asInputStream()
      java.nio.IntBuffer asIntBuffer()
      java.nio.LongBuffer asLongBuffer()
      java.io.OutputStream asOutputStream()
      IoBuffer asReadOnlyBuffer()
      protected abstract IoBuffer asReadOnlyBuffer0()
      Implement this method to return the unexpandable read only version of this buffer.
      java.nio.ShortBuffer asShortBuffer()
      protected abstract void buf​(java.nio.ByteBuffer newBuf)
      Sets the underlying NIO buffer instance.
      int capacity()
      IoBuffer capacity​(int newCapacity)
      Increases the capacity of this buffer.
      IoBuffer clear()
      IoBuffer compact()
      int compareTo​(IoBuffer that)
      IoBuffer duplicate()
      protected abstract IoBuffer duplicate0()
      Implement this method to return the unexpandable duplicate of this buffer.
      boolean equals​(java.lang.Object o)
      IoBuffer expand​(int expectedRemaining)
      Changes the capacity and limit of this buffer so this buffer get the specified expectedRemaining room from the current position.
      IoBuffer expand​(int pos, int expectedRemaining)
      Changes the capacity and limit of this buffer so this buffer get the specified expectedRemaining room from the specified position.
      IoBuffer fill​(byte value, int size)
      Fills this buffer with the specified value.
      IoBuffer fill​(int size)
      Fills this buffer with NUL (0x00).
      IoBuffer fillAndReset​(byte value, int size)
      Fills this buffer with the specified value.
      IoBuffer fillAndReset​(int size)
      Fills this buffer with NUL (0x00).
      IoBuffer flip()
      byte get()
      IoBuffer get​(byte[] dst)
      IoBuffer get​(byte[] dst, int offset, int length)
      byte get​(int index)
      char getChar()
      char getChar​(int index)
      double getDouble()
      double getDouble​(int index)
      <E extends java.lang.Enum<E>>
      E
      getEnum​(int index, java.lang.Class<E> enumClass)
      Reads a byte from the buffer and returns the correlating enum constant defined by the specified enum type.
      <E extends java.lang.Enum<E>>
      E
      getEnum​(java.lang.Class<E> enumClass)
      Reads a byte from the buffer and returns the correlating enum constant defined by the specified enum type.
      <E extends java.lang.Enum<E>>
      E
      getEnumInt​(int index, java.lang.Class<E> enumClass)
      Reads an int from the buffer and returns the correlating enum constant defined by the specified enum type.
      <E extends java.lang.Enum<E>>
      E
      getEnumInt​(java.lang.Class<E> enumClass)
      Reads an int from the buffer and returns the correlating enum constant defined by the specified enum type.
      <E extends java.lang.Enum<E>>
      java.util.Set<E>
      getEnumSet​(int index, java.lang.Class<E> enumClass)
      Reads a byte sized bit vector and converts it to an EnumSet.
      <E extends java.lang.Enum<E>>
      java.util.Set<E>
      getEnumSet​(java.lang.Class<E> enumClass)
      Reads a byte sized bit vector and converts it to an EnumSet.
      <E extends java.lang.Enum<E>>
      java.util.Set<E>
      getEnumSetInt​(int index, java.lang.Class<E> enumClass)
      Reads an int sized bit vector and converts it to an EnumSet.
      <E extends java.lang.Enum<E>>
      java.util.Set<E>
      getEnumSetInt​(java.lang.Class<E> enumClass)
      Reads an int sized bit vector and converts it to an EnumSet.
      <E extends java.lang.Enum<E>>
      java.util.Set<E>
      getEnumSetLong​(int index, java.lang.Class<E> enumClass)
      Reads a long sized bit vector and converts it to an EnumSet.
      <E extends java.lang.Enum<E>>
      java.util.Set<E>
      getEnumSetLong​(java.lang.Class<E> enumClass)
      Reads a long sized bit vector and converts it to an EnumSet.
      <E extends java.lang.Enum<E>>
      java.util.Set<E>
      getEnumSetShort​(int index, java.lang.Class<E> enumClass)
      Reads a short sized bit vector and converts it to an EnumSet.
      <E extends java.lang.Enum<E>>
      java.util.Set<E>
      getEnumSetShort​(java.lang.Class<E> enumClass)
      Reads a short sized bit vector and converts it to an EnumSet.
      <E extends java.lang.Enum<E>>
      E
      getEnumShort​(int index, java.lang.Class<E> enumClass)
      Reads a short from the buffer and returns the correlating enum constant defined by the specified enum type.
      <E extends java.lang.Enum<E>>
      E
      getEnumShort​(java.lang.Class<E> enumClass)
      Reads a short from the buffer and returns the correlating enum constant defined by the specified enum type.
      float getFloat()
      float getFloat​(int index)
      java.lang.String getHexDump()
      Returns hexdump of this buffer.
      java.lang.String getHexDump​(int lengthLimit)
      Return hexdump of this buffer with limited length.
      int getInt()
      int getInt​(int index)
      long getLong()
      long getLong​(int index)
      int getMediumInt()
      Relative get method for reading a medium int value.
      int getMediumInt​(int index)
      Absolute get method for reading a medium int value.
      java.lang.Object getObject()
      Reads a Java object from the buffer using the context ClassLoader of the current thread.
      java.lang.Object getObject​(java.lang.ClassLoader classLoader)
      Reads a Java object from the buffer using the specified classLoader.
      java.lang.String getPrefixedString​(int prefixLength, java.nio.charset.CharsetDecoder decoder)
      Reads a string which has a length field before the actual encoded string, using the specified decoder and returns it.
      java.lang.String getPrefixedString​(java.nio.charset.CharsetDecoder decoder)
      Reads a string which has a 16-bit length field before the actual encoded string, using the specified decoder and returns it.
      short getShort()
      short getShort​(int index)
      IoBuffer getSlice​(int length)
      Get a new IoBuffer containing a slice of the current buffer
      IoBuffer getSlice​(int index, int length)
      Get a new IoBuffer containing a slice of the current buffer
      java.lang.String getString​(int fieldSize, java.nio.charset.CharsetDecoder decoder)
      Reads a NUL-terminated string from this buffer using the specified decoder and returns it.
      java.lang.String getString​(java.nio.charset.CharsetDecoder decoder)
      Reads a NUL-terminated string from this buffer using the specified decoder and returns it.
      short getUnsigned()
      Reads one unsigned byte as a short integer.
      short getUnsigned​(int index)
      Reads one byte as an unsigned short integer.
      long getUnsignedInt()
      Reads four bytes unsigned integer.
      long getUnsignedInt​(int index)
      Reads four bytes unsigned integer.
      int getUnsignedMediumInt()
      Relative get method for reading an unsigned medium int value.
      int getUnsignedMediumInt​(int index)
      Absolute get method for reading an unsigned medium int value.
      int getUnsignedShort()
      Reads two bytes unsigned integer.
      int getUnsignedShort​(int index)
      Reads two bytes unsigned integer.
      int hashCode()
      boolean hasRemaining()
      int indexOf​(byte b)
      Returns the first occurrence position of the specified byte from the current position to the current limit.
      boolean isAutoExpand()
      boolean isAutoShrink()
      boolean isDerived()
      boolean isDirect()
      boolean isReadOnly()
      int limit()
      IoBuffer limit​(int newLimit)
      IoBuffer mark()
      int markValue()
      int minimumCapacity()
      IoBuffer minimumCapacity​(int minimumCapacity)
      Sets the minimum capacity of this buffer which is used to determine the new capacity of the buffer shrunk by IoBuffer.compact() and IoBuffer.shrink() operation.
      java.nio.ByteOrder order()
      IoBuffer order​(java.nio.ByteOrder bo)
      int position()
      IoBuffer position​(int newPosition)
      boolean prefixedDataAvailable​(int prefixLength)
      boolean prefixedDataAvailable​(int prefixLength, int maxDataLength)
      IoBuffer put​(byte b)
      IoBuffer put​(byte[] src)
      IoBuffer put​(byte[] src, int offset, int length)
      IoBuffer put​(int index, byte b)
      IoBuffer put​(java.nio.ByteBuffer src)
      Writes the content of the specified src into this buffer.
      IoBuffer put​(IoBuffer src)
      Writes the content of the specified src into this buffer.
      IoBuffer putChar​(char value)
      IoBuffer putChar​(int index, char value)
      IoBuffer putDouble​(double value)
      IoBuffer putDouble​(int index, double value)
      IoBuffer putEnum​(int index, java.lang.Enum<?> e)
      Writes an enum's ordinal value to the buffer as a byte.
      IoBuffer putEnum​(java.lang.Enum<?> e)
      Writes an enum's ordinal value to the buffer as a byte.
      IoBuffer putEnumInt​(int index, java.lang.Enum<?> e)
      Writes an enum's ordinal value to the buffer as an integer.
      IoBuffer putEnumInt​(java.lang.Enum<?> e)
      Writes an enum's ordinal value to the buffer as an integer.
      <E extends java.lang.Enum<E>>
      IoBuffer
      putEnumSet​(int index, java.util.Set<E> set)
      Writes the specified Set to the buffer as a byte sized bit vector.
      <E extends java.lang.Enum<E>>
      IoBuffer
      putEnumSet​(java.util.Set<E> set)
      Writes the specified Set to the buffer as a byte sized bit vector.
      <E extends java.lang.Enum<E>>
      IoBuffer
      putEnumSetInt​(int index, java.util.Set<E> set)
      Writes the specified Set to the buffer as an int sized bit vector.
      <E extends java.lang.Enum<E>>
      IoBuffer
      putEnumSetInt​(java.util.Set<E> set)
      Writes the specified Set to the buffer as an int sized bit vector.
      <E extends java.lang.Enum<E>>
      IoBuffer
      putEnumSetLong​(int index, java.util.Set<E> set)
      Writes the specified Set to the buffer as a long sized bit vector.
      <E extends java.lang.Enum<E>>
      IoBuffer
      putEnumSetLong​(java.util.Set<E> set)
      Writes the specified Set to the buffer as a long sized bit vector.
      <E extends java.lang.Enum<E>>
      IoBuffer
      putEnumSetShort​(int index, java.util.Set<E> set)
      Writes the specified Set to the buffer as a short sized bit vector.
      <E extends java.lang.Enum<E>>
      IoBuffer
      putEnumSetShort​(java.util.Set<E> set)
      Writes the specified Set to the buffer as a short sized bit vector.
      IoBuffer putEnumShort​(int index, java.lang.Enum<?> e)
      Writes an enum's ordinal value to the buffer as a short.
      IoBuffer putEnumShort​(java.lang.Enum<?> e)
      Writes an enum's ordinal value to the buffer as a short.
      IoBuffer putFloat​(float value)
      IoBuffer putFloat​(int index, float value)
      IoBuffer putInt​(int value)
      IoBuffer putInt​(int index, int value)
      IoBuffer putLong​(int index, long value)
      IoBuffer putLong​(long value)
      IoBuffer putMediumInt​(int value)
      Relative put method for writing a medium int value.
      IoBuffer putMediumInt​(int index, int value)
      Absolute put method for writing a medium int value.
      IoBuffer putObject​(java.lang.Object o)
      Writes the specified Java object to the buffer.
      IoBuffer putPrefixedString​(java.lang.CharSequence val, int prefixLength, int padding, byte padValue, java.nio.charset.CharsetEncoder encoder)
      Writes the content of val into this buffer as a string which has a 16-bit length field before the actual encoded string, using the specified encoder.
      IoBuffer putPrefixedString​(java.lang.CharSequence in, int prefixLength, int padding, java.nio.charset.CharsetEncoder encoder)
      Writes the content of in into this buffer as a string which has a 16-bit length field before the actual encoded string, using the specified encoder.
      IoBuffer putPrefixedString​(java.lang.CharSequence in, int prefixLength, java.nio.charset.CharsetEncoder encoder)
      Writes the content of in into this buffer as a string which has a 16-bit length field before the actual encoded string, using the specified encoder.
      IoBuffer putPrefixedString​(java.lang.CharSequence in, java.nio.charset.CharsetEncoder encoder)
      Writes the content of in into this buffer as a string which has a 16-bit length field before the actual encoded string, using the specified encoder.
      IoBuffer putShort​(int index, short value)
      IoBuffer putShort​(short value)
      IoBuffer putString​(java.lang.CharSequence val, int fieldSize, java.nio.charset.CharsetEncoder encoder)
      Writes the content of in into this buffer as a NUL-terminated string using the specified encoder.
      IoBuffer putString​(java.lang.CharSequence val, java.nio.charset.CharsetEncoder encoder)
      Writes the content of in into this buffer using the specified encoder.
      IoBuffer putUnsigned​(byte value)
      Writes an unsigned byte into the ByteBuffer
      IoBuffer putUnsigned​(int value)
      Writes an unsigned byte into the ByteBuffer
      IoBuffer putUnsigned​(int index, byte value)
      Writes an unsigned byte into the ByteBuffer at a specified position
      IoBuffer putUnsigned​(int index, int value)
      Writes an unsigned byte into the ByteBuffer at a specified position
      IoBuffer putUnsigned​(int index, long value)
      Writes an unsigned byte into the ByteBuffer at a specified position
      IoBuffer putUnsigned​(int index, short value)
      Writes an unsigned byte into the ByteBuffer at a specified position
      IoBuffer putUnsigned​(long value)
      Writes an unsigned byte into the ByteBuffer
      IoBuffer putUnsigned​(short value)
      Writes an unsigned byte into the ByteBuffer
      IoBuffer putUnsignedInt​(byte value)
      Writes an unsigned int into the ByteBuffer
      IoBuffer putUnsignedInt​(int value)
      Writes an unsigned int into the ByteBuffer
      IoBuffer putUnsignedInt​(int index, byte value)
      Writes an unsigned int into the ByteBuffer at a specified position
      IoBuffer putUnsignedInt​(int index, int value)
      Writes an unsigned int into the ByteBuffer at a specified position
      IoBuffer putUnsignedInt​(int index, long value)
      Writes an unsigned int into the ByteBuffer at a specified position
      IoBuffer putUnsignedInt​(int index, short value)
      Writes an unsigned int into the ByteBuffer at a specified position
      IoBuffer putUnsignedInt​(long value)
      Writes an unsigned int into the ByteBuffer
      IoBuffer putUnsignedInt​(short value)
      Writes an unsigned int into the ByteBuffer
      IoBuffer putUnsignedShort​(byte value)
      Writes an unsigned short into the ByteBuffer
      IoBuffer putUnsignedShort​(int value)
      Writes an unsigned Short into the ByteBuffer
      IoBuffer putUnsignedShort​(int index, byte value)
      Writes an unsigned Short into the ByteBuffer at a specified position
      IoBuffer putUnsignedShort​(int index, int value)
      Writes an unsigned Short into the ByteBuffer at a specified position
      IoBuffer putUnsignedShort​(int index, long value)
      Writes an unsigned Short into the ByteBuffer at a specified position
      IoBuffer putUnsignedShort​(int index, short value)
      Writes an unsigned Short into the ByteBuffer at a specified position
      IoBuffer putUnsignedShort​(long value)
      Writes an unsigned Short into the ByteBuffer
      IoBuffer putUnsignedShort​(short value)
      Writes an unsigned Short into the ByteBuffer
      int remaining()
      IoBuffer reset()
      IoBuffer rewind()
      IoBuffer setAutoExpand​(boolean autoExpand)
      Turns on or off autoExpand.
      IoBuffer setAutoShrink​(boolean autoShrink)
      Turns on or off autoShrink.
      IoBuffer shrink()
      Changes the capacity of this buffer so this buffer occupies as less memory as possible while retaining the position, limit and the buffer content between the position and limit.
      IoBuffer skip​(int size)
      Forwards the position of this buffer as the specified size bytes.
      IoBuffer slice()
      protected abstract IoBuffer slice0()
      Implement this method to return the unexpandable slice of this buffer.
      IoBuffer sweep()
      Clears this buffer and fills its content with NUL.
      IoBuffer sweep​(byte value)
      double Clears this buffer and fills its content with value.
      java.lang.String toString()
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • AbstractIoBuffer

        protected AbstractIoBuffer​(IoBufferAllocator allocator,
                                   int initialCapacity)
        Creates a new parent buffer.
        Parameters:
        allocator - The allocator to use to create new buffers
        initialCapacity - The initial buffer capacity when created
      • AbstractIoBuffer

        protected AbstractIoBuffer​(AbstractIoBuffer parent)
        Creates a new derived buffer. A derived buffer uses an existing buffer properties - the allocator and capacity -.
        Parameters:
        parent - The buffer we get the properties from
    • Method Detail

      • isDirect

        public final boolean isDirect()
        Specified by:
        isDirect in class IoBuffer
        Returns:
        True if this is a direct buffer
        See Also:
        ByteBuffer.isDirect()
      • isReadOnly

        public final boolean isReadOnly()
        Specified by:
        isReadOnly in class IoBuffer
        Returns:
        true if the buffer is readOnly
        See Also:
        Buffer.isReadOnly()
      • buf

        protected abstract void buf​(java.nio.ByteBuffer newBuf)
        Sets the underlying NIO buffer instance.
        Parameters:
        newBuf - The buffer to store within this IoBuffer
      • minimumCapacity

        public final int minimumCapacity()
        Specified by:
        minimumCapacity in class IoBuffer
        Returns:
        the minimum capacity of this buffer which is used to determine the new capacity of the buffer shrunk by the IoBuffer.compact() and IoBuffer.shrink() operation. The default value is the initial capacity of the buffer.
      • minimumCapacity

        public final IoBuffer minimumCapacity​(int minimumCapacity)
        Sets the minimum capacity of this buffer which is used to determine the new capacity of the buffer shrunk by IoBuffer.compact() and IoBuffer.shrink() operation. The default value is the initial capacity of the buffer.
        Specified by:
        minimumCapacity in class IoBuffer
        Parameters:
        minimumCapacity - the wanted minimum capacity
        Returns:
        the underlying NIO ByteBuffer instance.
      • capacity

        public final int capacity()
        Specified by:
        capacity in class IoBuffer
        Returns:
        the buffer capacity
        See Also:
        Buffer.capacity()
      • capacity

        public final IoBuffer capacity​(int newCapacity)
        Increases the capacity of this buffer. If the new capacity is less than or equal to the current capacity, this method returns the original buffer. If the new capacity is greater than the current capacity, the buffer is reallocated while retaining the position, limit, mark and the content of the buffer.
        Note that the IoBuffer is replaced, it's not copied.
        Assuming a buffer contains N bytes, its position is 0 and its current capacity is C, here are the resulting buffer if we set the new capacity to a value V < C and V > C :
          Initial buffer :
           
           0       L          C
          +--------+----------+
          |XXXXXXXX|          |
          +--------+----------+
           ^       ^          ^
           |       |          |
          pos    limit     capacity
          
         V <= C :
         
           0       L          C
          +--------+----------+
          |XXXXXXXX|          |
          +--------+----------+
           ^       ^          ^
           |       |          |
          pos    limit   newCapacity
          
         V > C :
         
           0       L          C            V
          +--------+-----------------------+
          |XXXXXXXX|          :            |
          +--------+-----------------------+
           ^       ^          ^            ^
           |       |          |            |
          pos    limit   oldCapacity  newCapacity
          
          The buffer has been increased.
          
         
        Specified by:
        capacity in class IoBuffer
        Parameters:
        newCapacity - the wanted capacity
        Returns:
        the underlying NIO ByteBuffer instance.
      • isAutoExpand

        public final boolean isAutoExpand()
        Specified by:
        isAutoExpand in class IoBuffer
        Returns:
        true if and only if autoExpand is turned on.
      • isAutoShrink

        public final boolean isAutoShrink()
        Specified by:
        isAutoShrink in class IoBuffer
        Returns:
        true if and only if autoShrink is turned on.
      • setAutoExpand

        public final IoBuffer setAutoExpand​(boolean autoExpand)
        Turns on or off autoExpand.
        Specified by:
        setAutoExpand in class IoBuffer
        Parameters:
        autoExpand - The flag value to set
        Returns:
        The modified IoBuffer instance
      • setAutoShrink

        public final IoBuffer setAutoShrink​(boolean autoShrink)
        Turns on or off autoShrink.
        Specified by:
        setAutoShrink in class IoBuffer
        Parameters:
        autoShrink - The flag value to set
        Returns:
        The modified IoBuffer instance
      • expand

        public final IoBuffer expand​(int expectedRemaining)
        Changes the capacity and limit of this buffer so this buffer get the specified expectedRemaining room from the current position. This method works even if you didn't set autoExpand to true.
        Assuming a buffer contains N bytes, its position is P and its current capacity is C, here are the resulting buffer if we call the expand method with a expectedRemaining value V :
          Initial buffer :
           
           0       L          C
          +--------+----------+
          |XXXXXXXX|          |
          +--------+----------+
           ^       ^          ^
           |       |          |
          pos    limit     capacity
          
         ( pos + V )  <= L, no change :
         
           0       L          C
          +--------+----------+
          |XXXXXXXX|          |
          +--------+----------+
           ^       ^          ^
           |       |          |
          pos    limit   newCapacity
          
         You can still put ( L - pos ) bytes in the buffer
          
         ( pos + V ) > L & ( pos + V ) <= C :
         
          0        L          C
          +------------+------+
          |XXXXXXXX:...|      |
          +------------+------+
           ^           ^      ^
           |           |      |
          pos       newlimit  newCapacity
          
          You can now put ( L - pos + V )  bytes in the buffer.
          
          
          ( pos + V ) > C
         
           0       L          C
          +-------------------+----+
          |XXXXXXXX:..........:....|
          +------------------------+
           ^                       ^
           |                       |
          pos                      +-- newlimit
                                   |
                                   +-- newCapacity
                                   
         You can now put ( L - pos + V ) bytes in the buffer, which limit is now
         equals to the capacity.
         
        Note that the expecting remaining bytes starts at the current position. In all those examples, the position is 0.
        Specified by:
        expand in class IoBuffer
        Parameters:
        expectedRemaining - The expected remaining bytes in the buffer
        Returns:
        The modified IoBuffer instance
      • expand

        public final IoBuffer expand​(int pos,
                                     int expectedRemaining)
        Changes the capacity and limit of this buffer so this buffer get the specified expectedRemaining room from the specified position. This method works even if you didn't set autoExpand to true. Assuming a buffer contains N bytes, its position is P and its current capacity is C, here are the resulting buffer if we call the expand method with a expectedRemaining value V :
          Initial buffer :
           
              P    L          C
          +--------+----------+
          |XXXXXXXX|          |
          +--------+----------+
              ^    ^          ^
              |    |          |
             pos limit     capacity
          
         ( pos + V )  <= L, no change :
         
              P    L          C
          +--------+----------+
          |XXXXXXXX|          |
          +--------+----------+
              ^    ^          ^
              |    |          |
             pos limit   newCapacity
          
         You can still put ( L - pos ) bytes in the buffer
          
         ( pos + V ) > L & ( pos + V ) <= C :
         
              P    L          C
          +------------+------+
          |XXXXXXXX:...|      |
          +------------+------+
              ^        ^      ^
              |        |      |
             pos    newlimit  newCapacity
          
          You can now put ( L - pos + V)  bytes in the buffer.
          
          
          ( pos + V ) > C
         
              P       L          C
          +-------------------+----+
          |XXXXXXXX:..........:....|
          +------------------------+
              ^                    ^
              |                    |
             pos                   +-- newlimit
                                   |
                                   +-- newCapacity
                                   
         You can now put ( L - pos + V ) bytes in the buffer, which limit is now
         equals to the capacity.
         
        Note that the expecting remaining bytes starts at the current position. In all those examples, the position is P.
        Specified by:
        expand in class IoBuffer
        Parameters:
        pos - The starting position from which we want to define a remaining number of bytes
        expectedRemaining - The expected remaining bytes in the buffer
        Returns:
        The modified IoBuffer instance
      • shrink

        public final IoBuffer shrink()
        Changes the capacity of this buffer so this buffer occupies as less memory as possible while retaining the position, limit and the buffer content between the position and limit.
        The capacity of the buffer never becomes less than IoBuffer.minimumCapacity()
        . The mark is discarded once the capacity changes.
        Typically, a call to this method tries to remove as much unused bytes as possible, dividing by two the initial capacity until it can't without obtaining a new capacity lower than the IoBuffer.minimumCapacity(). For instance, if the limit is 7 and the capacity is 36, with a minimum capacity of 8, shrinking the buffer will left a capacity of 9 (we go down from 36 to 18, then from 18 to 9).
          Initial buffer :
           
          +--------+----------+
          |XXXXXXXX|          |
          +--------+----------+
              ^    ^  ^       ^
              |    |  |       |
             pos   |  |    capacity
                   |  |
                   |  +-- minimumCapacity
                   |
                   +-- limit
         
         Resulting buffer :
         
          +--------+--+-+
          |XXXXXXXX|  | |
          +--------+--+-+
              ^    ^  ^ ^
              |    |  | |
              |    |  | +-- new capacity
              |    |  |
             pos   |  +-- minimum capacity
                   |
                   +-- limit
         
        Specified by:
        shrink in class IoBuffer
        Returns:
        The modified IoBuffer instance
      • position

        public final int position()
        Specified by:
        position in class IoBuffer
        Returns:
        The current position in the buffer
        See Also:
        Buffer.position()
      • position

        public final IoBuffer position​(int newPosition)
        Specified by:
        position in class IoBuffer
        Parameters:
        newPosition - Sets the new position in the buffer
        Returns:
        the modified IoBuffer
        See Also:
        Buffer.position(int)
      • limit

        public final int limit()
        Specified by:
        limit in class IoBuffer
        Returns:
        the modified IoBuffer 's limit
        See Also:
        Buffer.limit()
      • limit

        public final IoBuffer limit​(int newLimit)
        Specified by:
        limit in class IoBuffer
        Parameters:
        newLimit - The new buffer's limit
        Returns:
        the modified IoBuffer
        See Also:
        Buffer.limit(int)
      • mark

        public final IoBuffer mark()
        Specified by:
        mark in class IoBuffer
        Returns:
        the modified IoBuffer
        See Also:
        Buffer.mark()
      • markValue

        public final int markValue()
        Specified by:
        markValue in class IoBuffer
        Returns:
        the position of the current mark. This method returns -1 if no mark is set.
      • reset

        public final IoBuffer reset()
        Specified by:
        reset in class IoBuffer
        Returns:
        the modified IoBuffer
        See Also:
        Buffer.reset()
      • clear

        public final IoBuffer clear()
        Specified by:
        clear in class IoBuffer
        Returns:
        the modified IoBuffer
        See Also:
        Buffer.clear()
      • sweep

        public final IoBuffer sweep()
        Clears this buffer and fills its content with NUL. The position is set to zero, the limit is set to the capacity, and the mark is discarded.
        Specified by:
        sweep in class IoBuffer
        Returns:
        the modified IoBuffer
      • sweep

        public final IoBuffer sweep​(byte value)
        double Clears this buffer and fills its content with value. The position is set to zero, the limit is set to the capacity, and the mark is discarded.
        Specified by:
        sweep in class IoBuffer
        Parameters:
        value - The value to put in the buffer
        Returns:
        the modified IoBuffer
      • flip

        public final IoBuffer flip()
        Specified by:
        flip in class IoBuffer
        Returns:
        the modified IoBuffer
        See Also:
        Buffer.flip()
      • rewind

        public final IoBuffer rewind()
        Specified by:
        rewind in class IoBuffer
        Returns:
        the modified IoBuffer
        See Also:
        Buffer.rewind()
      • remaining

        public final int remaining()
        Specified by:
        remaining in class IoBuffer
        Returns:
        The remaining bytes in the buffer
        See Also:
        Buffer.remaining()
      • hasRemaining

        public final boolean hasRemaining()
        Specified by:
        hasRemaining in class IoBuffer
        Returns:
        true if there are some remaining bytes in the buffer
        See Also:
        Buffer.hasRemaining()
      • get

        public final byte get()
        Specified by:
        get in class IoBuffer
        Returns:
        The byte at the current position
        See Also:
        ByteBuffer.get()
      • getUnsigned

        public final short getUnsigned()
        Reads one unsigned byte as a short integer.
        Specified by:
        getUnsigned in class IoBuffer
        Returns:
        the unsigned short at the current position
      • put

        public final IoBuffer put​(byte b)
        Specified by:
        put in class IoBuffer
        Parameters:
        b - The byte to put in the buffer
        Returns:
        the modified IoBuffer
        See Also:
        ByteBuffer.put(byte)
      • putUnsigned

        public IoBuffer putUnsigned​(byte value)
        Writes an unsigned byte into the ByteBuffer
        Specified by:
        putUnsigned in class IoBuffer
        Parameters:
        value - the byte to write
        Returns:
        the modified IoBuffer
      • putUnsigned

        public IoBuffer putUnsigned​(int index,
                                    byte value)
        Writes an unsigned byte into the ByteBuffer at a specified position
        Specified by:
        putUnsigned in class IoBuffer
        Parameters:
        index - the position in the buffer to write the value
        value - the byte to write
        Returns:
        the modified IoBuffer
      • putUnsigned

        public IoBuffer putUnsigned​(short value)
        Writes an unsigned byte into the ByteBuffer
        Specified by:
        putUnsigned in class IoBuffer
        Parameters:
        value - the short to write
        Returns:
        the modified IoBuffer
      • putUnsigned

        public IoBuffer putUnsigned​(int index,
                                    short value)
        Writes an unsigned byte into the ByteBuffer at a specified position
        Specified by:
        putUnsigned in class IoBuffer
        Parameters:
        index - the position in the buffer to write the value
        value - the short to write
        Returns:
        the modified IoBuffer
      • putUnsigned

        public IoBuffer putUnsigned​(int value)
        Writes an unsigned byte into the ByteBuffer
        Specified by:
        putUnsigned in class IoBuffer
        Parameters:
        value - the int to write
        Returns:
        the modified IoBuffer
      • putUnsigned

        public IoBuffer putUnsigned​(int index,
                                    int value)
        Writes an unsigned byte into the ByteBuffer at a specified position
        Specified by:
        putUnsigned in class IoBuffer
        Parameters:
        index - the position in the buffer to write the value
        value - the int to write
        Returns:
        the modified IoBuffer
      • putUnsigned

        public IoBuffer putUnsigned​(long value)
        Writes an unsigned byte into the ByteBuffer
        Specified by:
        putUnsigned in class IoBuffer
        Parameters:
        value - the long to write
        Returns:
        the modified IoBuffer
      • putUnsigned

        public IoBuffer putUnsigned​(int index,
                                    long value)
        Writes an unsigned byte into the ByteBuffer at a specified position
        Specified by:
        putUnsigned in class IoBuffer
        Parameters:
        index - the position in the buffer to write the value
        value - the long to write
        Returns:
        the modified IoBuffer
      • get

        public final byte get​(int index)
        Specified by:
        get in class IoBuffer
        Parameters:
        index - The position for which we want to read a byte
        Returns:
        the byte at the given position
        See Also:
        ByteBuffer.get(int)
      • getUnsigned

        public final short getUnsigned​(int index)
        Reads one byte as an unsigned short integer.
        Specified by:
        getUnsigned in class IoBuffer
        Parameters:
        index - The position for which we want to read an unsigned byte
        Returns:
        the unsigned byte at the given position
      • put

        public final IoBuffer put​(int index,
                                  byte b)
        Specified by:
        put in class IoBuffer
        Parameters:
        index - The position where the byte will be put
        b - The byte to put
        Returns:
        the modified IoBuffer
        See Also:
        ByteBuffer.put(int, byte)
      • get

        public final IoBuffer get​(byte[] dst,
                                  int offset,
                                  int length)
        Specified by:
        get in class IoBuffer
        Parameters:
        dst - The destination buffer
        offset - The position in the original buffer
        length - The number of bytes to copy
        Returns:
        the modified IoBuffer
        See Also:
        ByteBuffer.get(byte[], int, int)
      • put

        public final IoBuffer put​(java.nio.ByteBuffer src)
        Writes the content of the specified src into this buffer.
        Specified by:
        put in class IoBuffer
        Parameters:
        src - The source ByteBuffer
        Returns:
        the modified IoBuffer
      • put

        public final IoBuffer put​(byte[] src,
                                  int offset,
                                  int length)
        Specified by:
        put in class IoBuffer
        Parameters:
        src - The byte[] to put
        offset - The position in the source
        length - The number of bytes to copy
        Returns:
        the modified IoBuffer
        See Also:
        ByteBuffer.put(byte[], int, int)
      • compact

        public final IoBuffer compact()
        Specified by:
        compact in class IoBuffer
        Returns:
        the modified IoBuffer
        See Also:
        ByteBuffer.compact()
      • order

        public final java.nio.ByteOrder order()
        Specified by:
        order in class IoBuffer
        Returns:
        the IoBuffer ByteOrder
        See Also:
        ByteBuffer.order()
      • order

        public final IoBuffer order​(java.nio.ByteOrder bo)
        Specified by:
        order in class IoBuffer
        Parameters:
        bo - The new ByteBuffer to use for this IoBuffer
        Returns:
        the modified IoBuffer
        See Also:
        ByteBuffer.order(ByteOrder)
      • getChar

        public final char getChar()
        Specified by:
        getChar in class IoBuffer
        Returns:
        The char at the current position
        See Also:
        ByteBuffer.getChar()
      • putChar

        public final IoBuffer putChar​(char value)
        Specified by:
        putChar in class IoBuffer
        Parameters:
        value - The char to put at the current position
        Returns:
        the modified IoBuffer
        See Also:
        ByteBuffer.putChar(char)
      • getChar

        public final char getChar​(int index)
        Specified by:
        getChar in class IoBuffer
        Parameters:
        index - The index in the IoBuffer where we will read a char from
        Returns:
        the char at 'index' position
        See Also:
        ByteBuffer.getChar(int)
      • putChar

        public final IoBuffer putChar​(int index,
                                      char value)
        Specified by:
        putChar in class IoBuffer
        Parameters:
        index - The index in the IoBuffer where we will put a char in
        value - The char to put at the current position
        Returns:
        the modified IoBuffer
        See Also:
        ByteBuffer.putChar(int, char)
      • asCharBuffer

        public final java.nio.CharBuffer asCharBuffer()
        Specified by:
        asCharBuffer in class IoBuffer
        Returns:
        a new CharBuffer
        See Also:
        ByteBuffer.asCharBuffer()
      • getShort

        public final short getShort()
        Specified by:
        getShort in class IoBuffer
        Returns:
        The read short
        See Also:
        ByteBuffer.getShort()
      • putShort

        public final IoBuffer putShort​(short value)
        Specified by:
        putShort in class IoBuffer
        Parameters:
        value - The short to put at the current position
        Returns:
        the modified IoBuffer
        See Also:
        ByteBuffer.putShort(short)
      • getShort

        public final short getShort​(int index)
        Specified by:
        getShort in class IoBuffer
        Parameters:
        index - The index in the IoBuffer where we will read a short from
        Returns:
        The read short
        See Also:
        ByteBuffer.getShort()
      • putShort

        public final IoBuffer putShort​(int index,
                                       short value)
        Specified by:
        putShort in class IoBuffer
        Parameters:
        index - The position at which the short should be written
        value - The short to put at the current position
        Returns:
        the modified IoBuffer
        See Also:
        ByteBuffer.putShort(int, short)
      • asShortBuffer

        public final java.nio.ShortBuffer asShortBuffer()
        Specified by:
        asShortBuffer in class IoBuffer
        Returns:
        A ShortBuffer from this IoBuffer
        See Also:
        ByteBuffer.asShortBuffer()
      • getInt

        public final int getInt()
        Specified by:
        getInt in class IoBuffer
        Returns:
        The int read
        See Also:
        ByteBuffer.getInt()
      • putInt

        public final IoBuffer putInt​(int value)
        Specified by:
        putInt in class IoBuffer
        Parameters:
        value - The int to put at the current position
        Returns:
        the modified IoBuffer
        See Also:
        ByteBuffer.putInt(int)
      • putUnsignedInt

        public final IoBuffer putUnsignedInt​(byte value)
        Writes an unsigned int into the ByteBuffer
        Specified by:
        putUnsignedInt in class IoBuffer
        Parameters:
        value - the byte to write
        Returns:
        the modified IoBuffer
      • putUnsignedInt

        public final IoBuffer putUnsignedInt​(int index,
                                             byte value)
        Writes an unsigned int into the ByteBuffer at a specified position
        Specified by:
        putUnsignedInt in class IoBuffer
        Parameters:
        index - the position in the buffer to write the value
        value - the byte to write
        Returns:
        the modified IoBuffer
      • putUnsignedInt

        public final IoBuffer putUnsignedInt​(short value)
        Writes an unsigned int into the ByteBuffer
        Specified by:
        putUnsignedInt in class IoBuffer
        Parameters:
        value - the short to write
        Returns:
        the modified IoBuffer
      • putUnsignedInt

        public final IoBuffer putUnsignedInt​(int index,
                                             short value)
        Writes an unsigned int into the ByteBuffer at a specified position
        Specified by:
        putUnsignedInt in class IoBuffer
        Parameters:
        index - the position in the buffer to write the value
        value - the short to write
        Returns:
        the modified IoBuffer
      • putUnsignedInt

        public final IoBuffer putUnsignedInt​(int value)
        Writes an unsigned int into the ByteBuffer
        Specified by:
        putUnsignedInt in class IoBuffer
        Parameters:
        value - the int to write
        Returns:
        the modified IoBuffer
      • putUnsignedInt

        public final IoBuffer putUnsignedInt​(int index,
                                             int value)
        Writes an unsigned int into the ByteBuffer at a specified position
        Specified by:
        putUnsignedInt in class IoBuffer
        Parameters:
        index - the position in the buffer to write the value
        value - the int to write
        Returns:
        the modified IoBuffer
      • putUnsignedInt

        public final IoBuffer putUnsignedInt​(long value)
        Writes an unsigned int into the ByteBuffer
        Specified by:
        putUnsignedInt in class IoBuffer
        Parameters:
        value - the long to write
        Returns:
        the modified IoBuffer
      • putUnsignedInt

        public final IoBuffer putUnsignedInt​(int index,
                                             long value)
        Writes an unsigned int into the ByteBuffer at a specified position
        Specified by:
        putUnsignedInt in class IoBuffer
        Parameters:
        index - the position in the buffer to write the value
        value - the long to write
        Returns:
        the modified IoBuffer
      • putUnsignedShort

        public final IoBuffer putUnsignedShort​(byte value)
        Writes an unsigned short into the ByteBuffer
        Specified by:
        putUnsignedShort in class IoBuffer
        Parameters:
        value - the byte to write
        Returns:
        the modified IoBuffer
      • putUnsignedShort

        public final IoBuffer putUnsignedShort​(int index,
                                               byte value)
        Writes an unsigned Short into the ByteBuffer at a specified position
        Specified by:
        putUnsignedShort in class IoBuffer
        Parameters:
        index - the position in the buffer to write the value
        value - the byte to write
        Returns:
        the modified IoBuffer
      • putUnsignedShort

        public final IoBuffer putUnsignedShort​(short value)
        Writes an unsigned Short into the ByteBuffer
        Specified by:
        putUnsignedShort in class IoBuffer
        Parameters:
        value - the short to write
        Returns:
        the modified IoBuffer
      • putUnsignedShort

        public final IoBuffer putUnsignedShort​(int index,
                                               short value)
        Writes an unsigned Short into the ByteBuffer at a specified position
        Specified by:
        putUnsignedShort in class IoBuffer
        Parameters:
        index - the position in the buffer to write the unsigned short
        value - the unsigned short to write
        Returns:
        the modified IoBuffer
      • putUnsignedShort

        public final IoBuffer putUnsignedShort​(int value)
        Writes an unsigned Short into the ByteBuffer
        Specified by:
        putUnsignedShort in class IoBuffer
        Parameters:
        value - the int to write
        Returns:
        the modified IoBuffer
      • putUnsignedShort

        public final IoBuffer putUnsignedShort​(int index,
                                               int value)
        Writes an unsigned Short into the ByteBuffer at a specified position
        Specified by:
        putUnsignedShort in class IoBuffer
        Parameters:
        index - the position in the buffer to write the value
        value - the int to write
        Returns:
        the modified IoBuffer
      • putUnsignedShort

        public final IoBuffer putUnsignedShort​(long value)
        Writes an unsigned Short into the ByteBuffer
        Specified by:
        putUnsignedShort in class IoBuffer
        Parameters:
        value - the long to write
        Returns:
        the modified IoBuffer
      • putUnsignedShort

        public final IoBuffer putUnsignedShort​(int index,
                                               long value)
        Writes an unsigned Short into the ByteBuffer at a specified position
        Specified by:
        putUnsignedShort in class IoBuffer
        Parameters:
        index - the position in the buffer to write the short
        value - the long to write
        Returns:
        the modified IoBuffer
      • getInt

        public final int getInt​(int index)
        Specified by:
        getInt in class IoBuffer
        Parameters:
        index - The index in the IoBuffer where we will read an int from
        Returns:
        the int at the given position
        See Also:
        ByteBuffer.getInt(int)
      • putInt

        public final IoBuffer putInt​(int index,
                                     int value)
        Specified by:
        putInt in class IoBuffer
        Parameters:
        index - The position where to put the int
        value - The int to put in the IoBuffer
        Returns:
        the modified IoBuffer
        See Also:
        ByteBuffer.putInt(int, int)
      • asIntBuffer

        public final java.nio.IntBuffer asIntBuffer()
        Specified by:
        asIntBuffer in class IoBuffer
        Returns:
        the modified IoBuffer
        See Also:
        ByteBuffer.asIntBuffer()
      • getLong

        public final long getLong()
        Specified by:
        getLong in class IoBuffer
        Returns:
        The long at the current position
        See Also:
        ByteBuffer.getLong()
      • putLong

        public final IoBuffer putLong​(long value)
        Specified by:
        putLong in class IoBuffer
        Parameters:
        value - The log to put in the IoBuffer
        Returns:
        the modified IoBuffer
        See Also:
        ByteBuffer.putLong(int, long)
      • getLong

        public final long getLong​(int index)
        Specified by:
        getLong in class IoBuffer
        Parameters:
        index - The index in the IoBuffer where we will read a long from
        Returns:
        the long at the given position
        See Also:
        ByteBuffer.getLong(int)
      • putLong

        public final IoBuffer putLong​(int index,
                                      long value)
        Specified by:
        putLong in class IoBuffer
        Parameters:
        index - The position where to put the long
        value - The long to put in the IoBuffer
        Returns:
        the modified IoBuffer
        See Also:
        ByteBuffer.putLong(int, long)
      • asLongBuffer

        public final java.nio.LongBuffer asLongBuffer()
        Specified by:
        asLongBuffer in class IoBuffer
        Returns:
        a LongBuffer from this IoBffer
        See Also:
        ByteBuffer.asLongBuffer()
      • getFloat

        public final float getFloat()
        Specified by:
        getFloat in class IoBuffer
        Returns:
        the float at the current position
        See Also:
        ByteBuffer.getFloat()
      • putFloat

        public final IoBuffer putFloat​(float value)
        Specified by:
        putFloat in class IoBuffer
        Parameters:
        value - The float to put in the IoBuffer
        Returns:
        the modified IoBuffer
        See Also:
        ByteBuffer.putFloat(float)
      • getFloat

        public final float getFloat​(int index)
        Specified by:
        getFloat in class IoBuffer
        Parameters:
        index - The index in the IoBuffer where we will read a float from
        Returns:
        The float at the given position
        See Also:
        ByteBuffer.getFloat(int)
      • putFloat

        public final IoBuffer putFloat​(int index,
                                       float value)
        Specified by:
        putFloat in class IoBuffer
        Parameters:
        index - The position where to put the float
        value - The float to put in the IoBuffer
        Returns:
        the modified IoBuffer
        See Also:
        ByteBuffer.putFloat(int, float)
      • asFloatBuffer

        public final java.nio.FloatBuffer asFloatBuffer()
        Specified by:
        asFloatBuffer in class IoBuffer
        Returns:
        A FloatBuffer from this IoBuffer
        See Also:
        ByteBuffer.asFloatBuffer()
      • getDouble

        public final double getDouble()
        Specified by:
        getDouble in class IoBuffer
        Returns:
        the double at the current position
        See Also:
        ByteBuffer.getDouble()
      • putDouble

        public final IoBuffer putDouble​(double value)
        Specified by:
        putDouble in class IoBuffer
        Parameters:
        value - The double to put at the IoBuffer current position
        Returns:
        the modified IoBuffer
        See Also:
        ByteBuffer.putDouble(double)
      • getDouble

        public final double getDouble​(int index)
        Specified by:
        getDouble in class IoBuffer
        Parameters:
        index - The position where to get the double from
        Returns:
        The double at the given position
        See Also:
        ByteBuffer.getDouble(int)
      • putDouble

        public final IoBuffer putDouble​(int index,
                                        double value)
        Specified by:
        putDouble in class IoBuffer
        Parameters:
        index - The position where to put the double
        value - The double to put in the IoBuffer
        Returns:
        the modified IoBuffer
        See Also:
        ByteBuffer.putDouble(int, double)
      • asDoubleBuffer

        public final java.nio.DoubleBuffer asDoubleBuffer()
        Specified by:
        asDoubleBuffer in class IoBuffer
        Returns:
        A buffer containing Double
        See Also:
        ByteBuffer.asDoubleBuffer()
      • asReadOnlyBuffer

        public final IoBuffer asReadOnlyBuffer()
        Specified by:
        asReadOnlyBuffer in class IoBuffer
        Returns:
        the modified IoBuffer
        See Also:
        ByteBuffer.asReadOnlyBuffer()
      • asReadOnlyBuffer0

        protected abstract IoBuffer asReadOnlyBuffer0()
        Implement this method to return the unexpandable read only version of this buffer.
        Returns:
        the IoBoffer instance
      • duplicate

        public final IoBuffer duplicate()
        Specified by:
        duplicate in class IoBuffer
        Returns:
        the modified IoBuffer
        See Also:
        ByteBuffer.duplicate()
      • duplicate0

        protected abstract IoBuffer duplicate0()
        Implement this method to return the unexpandable duplicate of this buffer.
        Returns:
        the IoBoffer instance
      • slice

        public final IoBuffer slice()
        Specified by:
        slice in class IoBuffer
        Returns:
        the modified IoBuffer
        See Also:
        ByteBuffer.slice()
      • getSlice

        public final IoBuffer getSlice​(int index,
                                       int length)
        Get a new IoBuffer containing a slice of the current buffer
        Specified by:
        getSlice in class IoBuffer
        Parameters:
        index - The position in the buffer
        length - The number of bytes to copy
        Returns:
        the new IoBuffer
      • getSlice

        public final IoBuffer getSlice​(int length)
        Get a new IoBuffer containing a slice of the current buffer
        Specified by:
        getSlice in class IoBuffer
        Parameters:
        length - The number of bytes to copy
        Returns:
        the new IoBuffer
      • slice0

        protected abstract IoBuffer slice0()
        Implement this method to return the unexpandable slice of this buffer.
        Returns:
        the IoBoffer instance
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • compareTo

        public int compareTo​(IoBuffer that)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • get

        public IoBuffer get​(byte[] dst)
        Specified by:
        get in class IoBuffer
        Parameters:
        dst - The byte[] that will contain the read bytes
        Returns:
        the IoBuffer
        See Also:
        ByteBuffer.get(byte[])
      • put

        public IoBuffer put​(IoBuffer src)
        Writes the content of the specified src into this buffer.
        Specified by:
        put in class IoBuffer
        Parameters:
        src - The source IoBuffer
        Returns:
        the modified IoBuffer
      • put

        public IoBuffer put​(byte[] src)
        Specified by:
        put in class IoBuffer
        Parameters:
        src - The byte[] to put
        Returns:
        the modified IoBuffer
        See Also:
        ByteBuffer.put(byte[])
      • getUnsignedShort

        public int getUnsignedShort()
        Reads two bytes unsigned integer.
        Specified by:
        getUnsignedShort in class IoBuffer
        Returns:
        The read unsigned short
      • getUnsignedShort

        public int getUnsignedShort​(int index)
        Reads two bytes unsigned integer.
        Specified by:
        getUnsignedShort in class IoBuffer
        Parameters:
        index - The index in the IoBuffer where we will read an unsigned short from
        Returns:
        the unsigned short at the given position
      • getUnsignedInt

        public long getUnsignedInt()
        Reads four bytes unsigned integer.
        Specified by:
        getUnsignedInt in class IoBuffer
        Returns:
        The unsigned int read
      • getMediumInt

        public int getMediumInt()
        Relative get method for reading a medium int value.

        Reads the next three bytes at this buffer's current position, composing them into an int value according to the current byte order, and then increments the position by three.

        Specified by:
        getMediumInt in class IoBuffer
        Returns:
        The medium int value at the buffer's current position
      • getUnsignedMediumInt

        public int getUnsignedMediumInt()
        Relative get method for reading an unsigned medium int value.

        Reads the next three bytes at this buffer's current position, composing them into an int value according to the current byte order, and then increments the position by three.

        Specified by:
        getUnsignedMediumInt in class IoBuffer
        Returns:
        The unsigned medium int value at the buffer's current position
      • getMediumInt

        public int getMediumInt​(int index)
        Absolute get method for reading a medium int value.

        Reads the next three bytes at this buffer's current position, composing them into an int value according to the current byte order.

        Specified by:
        getMediumInt in class IoBuffer
        Parameters:
        index - The index from which the medium int will be read
        Returns:
        The medium int value at the given index
      • getUnsignedMediumInt

        public int getUnsignedMediumInt​(int index)
        Absolute get method for reading an unsigned medium int value.

        Reads the next three bytes at this buffer's current position, composing them into an int value according to the current byte order.

        Specified by:
        getUnsignedMediumInt in class IoBuffer
        Parameters:
        index - The index from which the unsigned medium int will be read
        Returns:
        The unsigned medium int value at the given index
      • putMediumInt

        public IoBuffer putMediumInt​(int value)
        Relative put method for writing a medium int value.

        Writes three bytes containing the given int value, in the current byte order, into this buffer at the current position, and then increments the position by three.

        Specified by:
        putMediumInt in class IoBuffer
        Parameters:
        value - The medium int value to be written
        Returns:
        the modified IoBuffer
      • putMediumInt

        public IoBuffer putMediumInt​(int index,
                                     int value)
        Absolute put method for writing a medium int value.

        Writes three bytes containing the given int value, in the current byte order, into this buffer at the given index.

        Specified by:
        putMediumInt in class IoBuffer
        Parameters:
        index - The index at which the bytes will be written
        value - The medium int value to be written
        Returns:
        the modified IoBuffer
      • getUnsignedInt

        public long getUnsignedInt​(int index)
        Reads four bytes unsigned integer.
        Specified by:
        getUnsignedInt in class IoBuffer
        Parameters:
        index - The index in the IoBuffer where we will read an unsigned int from
        Returns:
        The long at the given position
      • asInputStream

        public java.io.InputStream asInputStream()
        Specified by:
        asInputStream in class IoBuffer
        Returns:
        an InputStream that reads the data from this buffer. InputStream.read() returns -1 if the buffer position reaches to the limit.
      • asOutputStream

        public java.io.OutputStream asOutputStream()
        Specified by:
        asOutputStream in class IoBuffer
        Returns:
        an OutputStream that appends the data into this buffer. Please note that the OutputStream.write(int) will throw a BufferOverflowException instead of an IOException in case of buffer overflow. Please set autoExpand property by calling IoBuffer.setAutoExpand(boolean) to prevent the unexpected runtime exception.
      • getHexDump

        public java.lang.String getHexDump()
        Returns hexdump of this buffer. The data and pointer are not changed as a result of this method call.
        Specified by:
        getHexDump in class IoBuffer
        Returns:
        hexidecimal representation of this buffer
      • getHexDump

        public java.lang.String getHexDump​(int lengthLimit)
        Return hexdump of this buffer with limited length.
        Specified by:
        getHexDump in class IoBuffer
        Parameters:
        lengthLimit - The maximum number of bytes to dump from the current buffer position.
        Returns:
        hexidecimal representation of this buffer
      • getString

        public java.lang.String getString​(java.nio.charset.CharsetDecoder decoder)
                                   throws java.nio.charset.CharacterCodingException
        Reads a NUL-terminated string from this buffer using the specified decoder and returns it. This method reads until the limit of this buffer if no NUL is found.
        Specified by:
        getString in class IoBuffer
        Parameters:
        decoder - The CharsetDecoder to use
        Returns:
        the read String
        Throws:
        java.nio.charset.CharacterCodingException - Thrown when an error occurred while decoding the buffer
      • getString

        public java.lang.String getString​(int fieldSize,
                                          java.nio.charset.CharsetDecoder decoder)
                                   throws java.nio.charset.CharacterCodingException
        Reads a NUL-terminated string from this buffer using the specified decoder and returns it.
        Specified by:
        getString in class IoBuffer
        Parameters:
        fieldSize - the maximum number of bytes to read
        decoder - The CharsetDecoder to use
        Returns:
        the read String
        Throws:
        java.nio.charset.CharacterCodingException - Thrown when an error occurred while decoding the buffer
      • putString

        public IoBuffer putString​(java.lang.CharSequence val,
                                  java.nio.charset.CharsetEncoder encoder)
                           throws java.nio.charset.CharacterCodingException
        Writes the content of in into this buffer using the specified encoder. This method doesn't terminate string with NUL. You have to do it by yourself.
        Specified by:
        putString in class IoBuffer
        Parameters:
        val - The CharSequence to put in the IoBuffer
        encoder - The CharsetEncoder to use
        Returns:
        The modified IoBuffer
        Throws:
        java.nio.charset.CharacterCodingException - When we have an error while decoding the String
      • putString

        public IoBuffer putString​(java.lang.CharSequence val,
                                  int fieldSize,
                                  java.nio.charset.CharsetEncoder encoder)
                           throws java.nio.charset.CharacterCodingException
        Writes the content of in into this buffer as a NUL-terminated string using the specified encoder.

        If the charset name of the encoder is UTF-16, you cannot specify odd fieldSize, and this method will append two NULs as a terminator.

        Please note that this method doesn't terminate with NUL if the input string is longer than fieldSize.

        Specified by:
        putString in class IoBuffer
        Parameters:
        val - The CharSequence to put in the IoBuffer
        fieldSize - the maximum number of bytes to write
        encoder - The CharsetEncoder to use
        Returns:
        The modified IoBuffer
        Throws:
        java.nio.charset.CharacterCodingException - When we have an error while decoding the String
      • getPrefixedString

        public java.lang.String getPrefixedString​(java.nio.charset.CharsetDecoder decoder)
                                           throws java.nio.charset.CharacterCodingException
        Reads a string which has a 16-bit length field before the actual encoded string, using the specified decoder and returns it. This method is a shortcut for getPrefixedString(2, decoder).
        Specified by:
        getPrefixedString in class IoBuffer
        Parameters:
        decoder - The CharsetDecoder to use
        Returns:
        The read String
        Throws:
        java.nio.charset.CharacterCodingException - When we have an error while decoding the String
      • getPrefixedString

        public java.lang.String getPrefixedString​(int prefixLength,
                                                  java.nio.charset.CharsetDecoder decoder)
                                           throws java.nio.charset.CharacterCodingException
        Reads a string which has a length field before the actual encoded string, using the specified decoder and returns it.
        Specified by:
        getPrefixedString in class IoBuffer
        Parameters:
        prefixLength - the length of the length field (1, 2, or 4)
        decoder - the decoder to use for decoding the string
        Returns:
        the prefixed string
        Throws:
        java.nio.charset.CharacterCodingException - when decoding fails
        java.nio.BufferUnderflowException - when there is not enough data available
      • putPrefixedString

        public IoBuffer putPrefixedString​(java.lang.CharSequence in,
                                          java.nio.charset.CharsetEncoder encoder)
                                   throws java.nio.charset.CharacterCodingException
        Writes the content of in into this buffer as a string which has a 16-bit length field before the actual encoded string, using the specified encoder. This method is a shortcut for putPrefixedString(in, 2, 0, encoder).
        Specified by:
        putPrefixedString in class IoBuffer
        Parameters:
        in - The CharSequence to put in the IoBuffer
        encoder - The CharsetEncoder to use
        Returns:
        The modified IoBuffer
        Throws:
        java.nio.charset.CharacterCodingException - When we have an error while decoding the CharSequence
      • putPrefixedString

        public IoBuffer putPrefixedString​(java.lang.CharSequence in,
                                          int prefixLength,
                                          java.nio.charset.CharsetEncoder encoder)
                                   throws java.nio.charset.CharacterCodingException
        Writes the content of in into this buffer as a string which has a 16-bit length field before the actual encoded string, using the specified encoder. This method is a shortcut for putPrefixedString(in, prefixLength, 0, encoder).
        Specified by:
        putPrefixedString in class IoBuffer
        Parameters:
        in - The CharSequence to put in the IoBuffer
        prefixLength - the length of the length field (1, 2, or 4)
        encoder - The CharsetEncoder to use
        Returns:
        The modified IoBuffer
        Throws:
        java.nio.charset.CharacterCodingException - When we have an error while decoding the CharSequence
      • putPrefixedString

        public IoBuffer putPrefixedString​(java.lang.CharSequence in,
                                          int prefixLength,
                                          int padding,
                                          java.nio.charset.CharsetEncoder encoder)
                                   throws java.nio.charset.CharacterCodingException
        Writes the content of in into this buffer as a string which has a 16-bit length field before the actual encoded string, using the specified encoder. This method is a shortcut for putPrefixedString(in, prefixLength, padding, ( byte ) 0, encoder)
        Specified by:
        putPrefixedString in class IoBuffer
        Parameters:
        in - The CharSequence to put in the IoBuffer
        prefixLength - the length of the length field (1, 2, or 4)
        padding - the number of padded NULs (1 (or 0), 2, or 4)
        encoder - The CharsetEncoder to use
        Returns:
        The modified IoBuffer
        Throws:
        java.nio.charset.CharacterCodingException - When we have an error while decoding the CharSequence
      • putPrefixedString

        public IoBuffer putPrefixedString​(java.lang.CharSequence val,
                                          int prefixLength,
                                          int padding,
                                          byte padValue,
                                          java.nio.charset.CharsetEncoder encoder)
                                   throws java.nio.charset.CharacterCodingException
        Writes the content of val into this buffer as a string which has a 16-bit length field before the actual encoded string, using the specified encoder.
        Specified by:
        putPrefixedString in class IoBuffer
        Parameters:
        val - The CharSequence to put in teh IoBuffer
        prefixLength - the length of the length field (1, 2, or 4)
        padding - the number of padded bytes (1 (or 0), 2, or 4)
        padValue - the value of padded bytes
        encoder - The CharsetEncoder to use
        Returns:
        The modified IoBuffer
        Throws:
        java.nio.charset.CharacterCodingException - When we have an error while decoding the CharSequence
      • getObject

        public java.lang.Object getObject()
                                   throws java.lang.ClassNotFoundException
        Reads a Java object from the buffer using the context ClassLoader of the current thread.
        Specified by:
        getObject in class IoBuffer
        Returns:
        The read Object
        Throws:
        java.lang.ClassNotFoundException - thrown when we can't find the Class to use
      • getObject

        public java.lang.Object getObject​(java.lang.ClassLoader classLoader)
                                   throws java.lang.ClassNotFoundException
        Reads a Java object from the buffer using the specified classLoader.
        Specified by:
        getObject in class IoBuffer
        Parameters:
        classLoader - The classLoader to use to read an Object from the IoBuffer
        Returns:
        The read Object
        Throws:
        java.lang.ClassNotFoundException - thrown when we can't find the Class to use
      • putObject

        public IoBuffer putObject​(java.lang.Object o)
        Writes the specified Java object to the buffer.
        Specified by:
        putObject in class IoBuffer
        Parameters:
        o - The Object to write in the IoBuffer
        Returns:
        The modified IoBuffer
      • prefixedDataAvailable

        public boolean prefixedDataAvailable​(int prefixLength)
        Specified by:
        prefixedDataAvailable in class IoBuffer
        Parameters:
        prefixLength - the length of the prefix field (1, 2, or 4)
        Returns:
        true if this buffer contains a data which has a data length as a prefix and the buffer has remaining data as enough as specified in the data length field. This method is identical with prefixedDataAvailable( prefixLength, Integer.MAX_VALUE ). Please not that using this method can allow DoS (Denial of Service) attack in case the remote peer sends too big data length value. It is recommended to use IoBuffer.prefixedDataAvailable(int, int) instead.
      • prefixedDataAvailable

        public boolean prefixedDataAvailable​(int prefixLength,
                                             int maxDataLength)
        Specified by:
        prefixedDataAvailable in class IoBuffer
        Parameters:
        prefixLength - the length of the prefix field (1, 2, or 4)
        maxDataLength - the allowed maximum of the read data length
        Returns:
        true if this buffer contains a data which has a data length as a prefix and the buffer has remaining data as enough as specified in the data length field.
      • indexOf

        public int indexOf​(byte b)
        Returns the first occurrence position of the specified byte from the current position to the current limit.
        Specified by:
        indexOf in class IoBuffer
        Parameters:
        b - The byte we are looking for
        Returns:
        -1 if the specified byte is not found
      • skip

        public IoBuffer skip​(int size)
        Forwards the position of this buffer as the specified size bytes.
        Specified by:
        skip in class IoBuffer
        Parameters:
        size - The added size
        Returns:
        The modified IoBuffer
      • fill

        public IoBuffer fill​(byte value,
                             int size)
        Fills this buffer with the specified value. This method moves buffer position forward.
        Specified by:
        fill in class IoBuffer
        Parameters:
        value - The value to fill the IoBuffer with
        size - The added size
        Returns:
        The modified IoBuffer
      • fillAndReset

        public IoBuffer fillAndReset​(byte value,
                                     int size)
        Fills this buffer with the specified value. This method does not change buffer position.
        Specified by:
        fillAndReset in class IoBuffer
        Parameters:
        value - The value to fill the IoBuffer with
        size - The added size
        Returns:
        The modified IoBuffer
      • fill

        public IoBuffer fill​(int size)
        Fills this buffer with NUL (0x00). This method moves buffer position forward.
        Specified by:
        fill in class IoBuffer
        Parameters:
        size - The added size
        Returns:
        The modified IoBuffer
      • fillAndReset

        public IoBuffer fillAndReset​(int size)
        Fills this buffer with NUL (0x00). This method does not change buffer position.
        Specified by:
        fillAndReset in class IoBuffer
        Parameters:
        size - The added size
        Returns:
        The modified IoBuffer
      • getEnum

        public <E extends java.lang.Enum<E>> E getEnum​(java.lang.Class<E> enumClass)
        Reads a byte from the buffer and returns the correlating enum constant defined by the specified enum type.
        Specified by:
        getEnum in class IoBuffer
        Type Parameters:
        E - The enum type to return
        Parameters:
        enumClass - The enum's class object
        Returns:
        The correlated enum constant
      • getEnum

        public <E extends java.lang.Enum<E>> E getEnum​(int index,
                                                       java.lang.Class<E> enumClass)
        Reads a byte from the buffer and returns the correlating enum constant defined by the specified enum type.
        Specified by:
        getEnum in class IoBuffer
        Type Parameters:
        E - The enum type to return
        Parameters:
        index - the index from which the byte will be read
        enumClass - The enum's class object
        Returns:
        The correlated enum constant
      • getEnumShort

        public <E extends java.lang.Enum<E>> E getEnumShort​(java.lang.Class<E> enumClass)
        Reads a short from the buffer and returns the correlating enum constant defined by the specified enum type.
        Specified by:
        getEnumShort in class IoBuffer
        Type Parameters:
        E - The enum type to return
        Parameters:
        enumClass - The enum's class object
        Returns:
        The correlated enum constant
      • getEnumShort

        public <E extends java.lang.Enum<E>> E getEnumShort​(int index,
                                                            java.lang.Class<E> enumClass)
        Reads a short from the buffer and returns the correlating enum constant defined by the specified enum type.
        Specified by:
        getEnumShort in class IoBuffer
        Type Parameters:
        E - The enum type to return
        Parameters:
        index - the index from which the bytes will be read
        enumClass - The enum's class object
        Returns:
        The correlated enum constant
      • getEnumInt

        public <E extends java.lang.Enum<E>> E getEnumInt​(java.lang.Class<E> enumClass)
        Reads an int from the buffer and returns the correlating enum constant defined by the specified enum type.
        Specified by:
        getEnumInt in class IoBuffer
        Type Parameters:
        E - The enum type to return
        Parameters:
        enumClass - The enum's class object
        Returns:
        The correlated enum constant
      • getEnumInt

        public <E extends java.lang.Enum<E>> E getEnumInt​(int index,
                                                          java.lang.Class<E> enumClass)
        Reads an int from the buffer and returns the correlating enum constant defined by the specified enum type.
        Specified by:
        getEnumInt in class IoBuffer
        Type Parameters:
        E - The enum type to return
        Parameters:
        index - the index from which the bytes will be read
        enumClass - The enum's class object
        Returns:
        The correlated enum constant
      • putEnum

        public IoBuffer putEnum​(java.lang.Enum<?> e)
        Writes an enum's ordinal value to the buffer as a byte.
        Specified by:
        putEnum in class IoBuffer
        Parameters:
        e - The enum to write to the buffer
        Returns:
        The modified IoBuffer
      • putEnum

        public IoBuffer putEnum​(int index,
                                java.lang.Enum<?> e)
        Writes an enum's ordinal value to the buffer as a byte.
        Specified by:
        putEnum in class IoBuffer
        Parameters:
        index - The index at which the byte will be written
        e - The enum to write to the buffer
        Returns:
        The modified IoBuffer
      • putEnumShort

        public IoBuffer putEnumShort​(java.lang.Enum<?> e)
        Writes an enum's ordinal value to the buffer as a short.
        Specified by:
        putEnumShort in class IoBuffer
        Parameters:
        e - The enum to write to the buffer
        Returns:
        The modified IoBuffer
      • putEnumShort

        public IoBuffer putEnumShort​(int index,
                                     java.lang.Enum<?> e)
        Writes an enum's ordinal value to the buffer as a short.
        Specified by:
        putEnumShort in class IoBuffer
        Parameters:
        index - The index at which the bytes will be written
        e - The enum to write to the buffer
        Returns:
        The modified IoBuffer
      • putEnumInt

        public IoBuffer putEnumInt​(java.lang.Enum<?> e)
        Writes an enum's ordinal value to the buffer as an integer.
        Specified by:
        putEnumInt in class IoBuffer
        Parameters:
        e - The enum to write to the buffer
        Returns:
        The modified IoBuffer
      • putEnumInt

        public IoBuffer putEnumInt​(int index,
                                   java.lang.Enum<?> e)
        Writes an enum's ordinal value to the buffer as an integer.
        Specified by:
        putEnumInt in class IoBuffer
        Parameters:
        index - The index at which the bytes will be written
        e - The enum to write to the buffer
        Returns:
        The modified IoBuffer
      • getEnumSet

        public <E extends java.lang.Enum<E>> java.util.Set<E> getEnumSet​(java.lang.Class<E> enumClass)
        Reads a byte sized bit vector and converts it to an EnumSet.

        Each bit is mapped to a value in the specified enum. The least significant bit maps to the first entry in the specified enum and each subsequent bit maps to each subsequent bit as mapped to the subsequent enum value.

        Specified by:
        getEnumSet in class IoBuffer
        Type Parameters:
        E - the enum type
        Parameters:
        enumClass - the enum class used to create the EnumSet
        Returns:
        the EnumSet representation of the bit vector
      • getEnumSet

        public <E extends java.lang.Enum<E>> java.util.Set<E> getEnumSet​(int index,
                                                                         java.lang.Class<E> enumClass)
        Reads a byte sized bit vector and converts it to an EnumSet.
        Specified by:
        getEnumSet in class IoBuffer
        Type Parameters:
        E - the enum type
        Parameters:
        index - the index from which the byte will be read
        enumClass - the enum class used to create the EnumSet
        Returns:
        the EnumSet representation of the bit vector
        See Also:
        IoBuffer.getEnumSet(Class)
      • getEnumSetShort

        public <E extends java.lang.Enum<E>> java.util.Set<E> getEnumSetShort​(java.lang.Class<E> enumClass)
        Reads a short sized bit vector and converts it to an EnumSet.
        Specified by:
        getEnumSetShort in class IoBuffer
        Type Parameters:
        E - the enum type
        Parameters:
        enumClass - the enum class used to create the EnumSet
        Returns:
        the EnumSet representation of the bit vector
        See Also:
        IoBuffer.getEnumSet(Class)
      • getEnumSetShort

        public <E extends java.lang.Enum<E>> java.util.Set<E> getEnumSetShort​(int index,
                                                                              java.lang.Class<E> enumClass)
        Reads a short sized bit vector and converts it to an EnumSet.
        Specified by:
        getEnumSetShort in class IoBuffer
        Type Parameters:
        E - the enum type
        Parameters:
        index - the index from which the bytes will be read
        enumClass - the enum class used to create the EnumSet
        Returns:
        the EnumSet representation of the bit vector
        See Also:
        IoBuffer.getEnumSet(Class)
      • getEnumSetInt

        public <E extends java.lang.Enum<E>> java.util.Set<E> getEnumSetInt​(java.lang.Class<E> enumClass)
        Reads an int sized bit vector and converts it to an EnumSet.
        Specified by:
        getEnumSetInt in class IoBuffer
        Type Parameters:
        E - the enum type
        Parameters:
        enumClass - the enum class used to create the EnumSet
        Returns:
        the EnumSet representation of the bit vector
        See Also:
        IoBuffer.getEnumSet(Class)
      • getEnumSetInt

        public <E extends java.lang.Enum<E>> java.util.Set<E> getEnumSetInt​(int index,
                                                                            java.lang.Class<E> enumClass)
        Reads an int sized bit vector and converts it to an EnumSet.
        Specified by:
        getEnumSetInt in class IoBuffer
        Type Parameters:
        E - the enum type
        Parameters:
        index - the index from which the bytes will be read
        enumClass - the enum class used to create the EnumSet
        Returns:
        the EnumSet representation of the bit vector
        See Also:
        IoBuffer.getEnumSet(Class)
      • getEnumSetLong

        public <E extends java.lang.Enum<E>> java.util.Set<E> getEnumSetLong​(java.lang.Class<E> enumClass)
        Reads a long sized bit vector and converts it to an EnumSet.
        Specified by:
        getEnumSetLong in class IoBuffer
        Type Parameters:
        E - the enum type
        Parameters:
        enumClass - the enum class used to create the EnumSet
        Returns:
        the EnumSet representation of the bit vector
        See Also:
        IoBuffer.getEnumSet(Class)
      • getEnumSetLong

        public <E extends java.lang.Enum<E>> java.util.Set<E> getEnumSetLong​(int index,
                                                                             java.lang.Class<E> enumClass)
        Reads a long sized bit vector and converts it to an EnumSet.
        Specified by:
        getEnumSetLong in class IoBuffer
        Type Parameters:
        E - the enum type
        Parameters:
        index - the index from which the bytes will be read
        enumClass - the enum class used to create the EnumSet
        Returns:
        the EnumSet representation of the bit vector
        See Also:
        IoBuffer.getEnumSet(Class)
      • putEnumSet

        public <E extends java.lang.Enum<E>> IoBuffer putEnumSet​(java.util.Set<E> set)
        Writes the specified Set to the buffer as a byte sized bit vector.
        Specified by:
        putEnumSet in class IoBuffer
        Type Parameters:
        E - the enum type of the Set
        Parameters:
        set - the enum set to write to the buffer
        Returns:
        the modified IoBuffer
      • putEnumSet

        public <E extends java.lang.Enum<E>> IoBuffer putEnumSet​(int index,
                                                                 java.util.Set<E> set)
        Writes the specified Set to the buffer as a byte sized bit vector.
        Specified by:
        putEnumSet in class IoBuffer
        Type Parameters:
        E - the enum type of the Set
        Parameters:
        index - the index at which the byte will be written
        set - the enum set to write to the buffer
        Returns:
        the modified IoBuffer
      • putEnumSetShort

        public <E extends java.lang.Enum<E>> IoBuffer putEnumSetShort​(java.util.Set<E> set)
        Writes the specified Set to the buffer as a short sized bit vector.
        Specified by:
        putEnumSetShort in class IoBuffer
        Type Parameters:
        E - the enum type of the Set
        Parameters:
        set - the enum set to write to the buffer
        Returns:
        the modified IoBuffer
      • putEnumSetShort

        public <E extends java.lang.Enum<E>> IoBuffer putEnumSetShort​(int index,
                                                                      java.util.Set<E> set)
        Writes the specified Set to the buffer as a short sized bit vector.
        Specified by:
        putEnumSetShort in class IoBuffer
        Type Parameters:
        E - the enum type of the Set
        Parameters:
        index - the index at which the bytes will be written
        set - the enum set to write to the buffer
        Returns:
        the modified IoBuffer
      • putEnumSetInt

        public <E extends java.lang.Enum<E>> IoBuffer putEnumSetInt​(java.util.Set<E> set)
        Writes the specified Set to the buffer as an int sized bit vector.
        Specified by:
        putEnumSetInt in class IoBuffer
        Type Parameters:
        E - the enum type of the Set
        Parameters:
        set - the enum set to write to the buffer
        Returns:
        the modified IoBuffer
      • putEnumSetInt

        public <E extends java.lang.Enum<E>> IoBuffer putEnumSetInt​(int index,
                                                                    java.util.Set<E> set)
        Writes the specified Set to the buffer as an int sized bit vector.
        Specified by:
        putEnumSetInt in class IoBuffer
        Type Parameters:
        E - the enum type of the Set
        Parameters:
        index - the index at which the bytes will be written
        set - the enum set to write to the buffer
        Returns:
        the modified IoBuffer
      • putEnumSetLong

        public <E extends java.lang.Enum<E>> IoBuffer putEnumSetLong​(java.util.Set<E> set)
        Writes the specified Set to the buffer as a long sized bit vector.
        Specified by:
        putEnumSetLong in class IoBuffer
        Type Parameters:
        E - the enum type of the Set
        Parameters:
        set - the enum set to write to the buffer
        Returns:
        the modified IoBuffer
      • putEnumSetLong

        public <E extends java.lang.Enum<E>> IoBuffer putEnumSetLong​(int index,
                                                                     java.util.Set<E> set)
        Writes the specified Set to the buffer as a long sized bit vector.
        Specified by:
        putEnumSetLong in class IoBuffer
        Type Parameters:
        E - the enum type of the Set
        Parameters:
        index - the index at which the bytes will be written
        set - the enum set to write to the buffer
        Returns:
        the modified IoBuffer