Class ByteBufferPacket

  • All Implemented Interfaces:
    Packet

    public final class ByteBufferPacket
    extends java.lang.Object
    implements Packet
    Provides a Packet implementation that is backed by a {@see java.nio.ByteBuffer}
    Version:
    $Revision$
    • Field Detail

      • DEFAULT_BUFFER_SIZE

        public static final int DEFAULT_BUFFER_SIZE
      • DEFAULT_DIRECT_BUFFER_SIZE

        public static final int DEFAULT_DIRECT_BUFFER_SIZE
    • Constructor Detail

      • ByteBufferPacket

        public ByteBufferPacket​(java.nio.ByteBuffer buffer)
    • Method Detail

      • getByteBuffer

        public java.nio.ByteBuffer getByteBuffer()
      • createDefaultBuffer

        public static ByteBufferPacket createDefaultBuffer​(boolean direct)
      • writeTo

        public void writeTo​(java.io.OutputStream out)
                     throws java.io.IOException
        Description copied from interface: Packet
        Writes the remaing bytes in the packet to the output stream.
        Specified by:
        writeTo in interface Packet
        Throws:
        java.io.IOException
      • writeTo

        public void writeTo​(java.io.DataOutput out)
                     throws java.io.IOException
        Specified by:
        writeTo in interface Packet
        Throws:
        java.io.IOException
      • capacity

        public int capacity()
        Specified by:
        capacity in interface Packet
      • clear

        public void clear()
        Specified by:
        clear in interface Packet
      • compact

        public Packet compact()
      • flip

        public void flip()
        Specified by:
        flip in interface Packet
      • hasRemaining

        public boolean hasRemaining()
        Specified by:
        hasRemaining in interface Packet
      • isDirect

        public boolean isDirect()
      • isReadOnly

        public boolean isReadOnly()
      • limit

        public int limit()
        Specified by:
        limit in interface Packet
      • limit

        public void limit​(int arg0)
        Specified by:
        limit in interface Packet
      • position

        public int position()
        Specified by:
        position in interface Packet
      • position

        public void position​(int arg0)
        Specified by:
        position in interface Packet
      • remaining

        public int remaining()
        Specified by:
        remaining in interface Packet
      • rewind

        public void rewind()
        Specified by:
        rewind in interface Packet
      • duplicate

        public java.lang.Object duplicate​(java.lang.ClassLoader cl)
                                   throws java.io.IOException
        Specified by:
        duplicate in interface Packet
        Throws:
        java.io.IOException
      • read

        public int read​(Packet dest)
        Specified by:
        read in interface Packet
        Parameters:
        dest -
        Returns:
        the number of bytes read into the dest.
      • toString

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

        public java.lang.Object getAdapter​(java.lang.Class target)
        Specified by:
        getAdapter in interface Packet
      • dispose

        public void dispose()
        Specified by:
        dispose in interface Packet