Class ByteBuffer


  • class ByteBuffer
    extends java.lang.Object
    Implements a simple byte array based buffer. Used to collect data one byte at a time into a buffer, then pass the collected data to the caller as an array.
    • Constructor Summary

      Constructors 
      Constructor Description
      ByteBuffer()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(int b)
      Add a byte to the buffer.
      void clear()
      Clear the buffer.
      boolean isEmpty()
      Determines if the buffer is empty.
      byte[] toArray()
      Return the buffer as an array.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • INITIAL_BUFFER_CAPACITY

        private static final int INITIAL_BUFFER_CAPACITY
        See Also:
        Constant Field Values
      • bufferSize

        private int bufferSize
      • buffer

        private byte[] buffer
    • Constructor Detail

      • ByteBuffer

        ByteBuffer()
    • Method Detail

      • add

        public void add​(int b)
        Add a byte to the buffer.
      • clear

        public void clear()
        Clear the buffer.
      • toArray

        public byte[] toArray()
        Return the buffer as an array.
      • isEmpty

        public boolean isEmpty()
        Determines if the buffer is empty.
      • toString

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