Class ByteQueue

java.lang.Object
org.bouncycastle.tls.ByteQueue

public class ByteQueue extends Object
A queue for bytes. This file could be more optimized.
  • Constructor Details Link icon

    • ByteQueue Link icon

      public ByteQueue()
    • ByteQueue Link icon

      public ByteQueue(int capacity)
    • ByteQueue Link icon

      public ByteQueue(byte[] buf, int off, int len)
  • Method Details Link icon

    • nextTwoPow Link icon

      public static int nextTwoPow(int i)
      Returns:
      The smallest number which can be written as 2^x which is bigger than i.
    • addData Link icon

      public void addData(byte[] buf, int off, int len)
      Add some data to our buffer.
      Parameters:
      buf - A byte-array to read data from.
      off - How many bytes to skip at the beginning of the array.
      len - How many bytes to read from the array.
    • available Link icon

      public int available()
      Returns:
      The number of bytes which are available in this buffer.
    • copyTo Link icon

      public void copyTo(OutputStream output, int length) throws IOException
      Copy some bytes from the beginning of the data to the provided OutputStream.
      Parameters:
      output - The OutputStream to copy the bytes to.
      length - How many bytes to copy.
      Throws:
      IOException
    • read Link icon

      public void read(byte[] buf, int offset, int len, int skip)
      Read data from the buffer.
      Parameters:
      buf - The buffer where the read data will be copied to.
      offset - How many bytes to skip at the beginning of buf.
      len - How many bytes to read at all.
      skip - How many bytes from our data to skip.
    • read Link icon

      public void read(ByteBuffer buf, int len, int skip)
      Read data from the buffer.
      Parameters:
      buf - The ByteBuffer where the read data will be copied to.
      len - How many bytes to read at all.
      skip - How many bytes from our data to skip.
    • readInt32 Link icon

      public int readInt32()
    • readUint8 Link icon

      public short readUint8(int skip)
    • readUint16 Link icon

      public int readUint16(int skip)
    • removeData Link icon

      public void removeData(int i)
      Remove some bytes from our data from the beginning.
      Parameters:
      i - How many bytes to remove.
    • removeData Link icon

      public void removeData(byte[] buf, int off, int len, int skip)
      Remove data from the buffer.
      Parameters:
      buf - The buffer where the removed data will be copied to.
      off - How many bytes to skip at the beginning of buf.
      len - How many bytes to read at all.
      skip - How many bytes from our data to skip.
    • removeData Link icon

      public void removeData(ByteBuffer buf, int len, int skip)
      Remove data from the buffer.
      Parameters:
      buf - The ByteBuffer where the removed data will be copied to.
      len - How many bytes to read at all.
      skip - How many bytes from our data to skip.
    • removeData Link icon

      public byte[] removeData(int len, int skip)
    • shrink Link icon

      public void shrink()