Class ByteBuffer

java.lang.Object
java.io.OutputStream
org.openjdk.asmtools.jcoder.ByteBuffer
All Implemented Interfaces:
Closeable, Flushable, AutoCloseable

class ByteBuffer extends OutputStream
Compiles just 1 source file
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected int
    The size of the increment.
    (package private) byte[]
    The buffer where elements are stored.
    (package private) int
    The number of elements in the buffer.
    (package private) String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs an empty vector.
    ByteBuffer(byte[] data)
    Constructs a full vector.
    ByteBuffer(byte[] data, int capacityIncrement)
    Constructs a full vector.
    ByteBuffer(int initialCapacity)
    Constructs an empty vector with the specified storage capacity.
    ByteBuffer(int initialCapacity, int capacityIncrement)
    Constructs an empty vector with the specified storage capacity and the specified capacityIncrement.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    append(long val, int width)
     
    final void
    ensureCapacity(int minCapacity)
    Ensures that the vector has at least the specified capacity.
    final int
    Returns the number of elements in the vector.
    void
    write(int val)
     
    void
    writeAt(int index, long val, int width)
     

    Methods inherited from class java.io.OutputStream

    close, flush, nullOutputStream, write, write

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • myname

      String myname
    • data

      byte[] data
      The buffer where elements are stored.
    • length

      int length
      The number of elements in the buffer.
    • capacityIncrement

      protected int capacityIncrement
      The size of the increment. If it is 0 the size of the the buffer is doubled everytime it needs to grow.
  • Constructor Details

    • ByteBuffer

      public ByteBuffer(int initialCapacity, int capacityIncrement)
      Constructs an empty vector with the specified storage capacity and the specified capacityIncrement.
      Parameters:
      initialCapacity - the initial storage capacity of the vector
      capacityIncrement - how much to increase the element's size by.
    • ByteBuffer

      public ByteBuffer(int initialCapacity)
      Constructs an empty vector with the specified storage capacity.
      Parameters:
      initialCapacity - the initial storage capacity of the vector
    • ByteBuffer

      public ByteBuffer()
      Constructs an empty vector.
    • ByteBuffer

      public ByteBuffer(byte[] data, int capacityIncrement)
      Constructs a full vector.
    • ByteBuffer

      public ByteBuffer(byte[] data)
      Constructs a full vector.
  • Method Details

    • size

      public final int size()
      Returns the number of elements in the vector. Note that this is not the same as the vector's capacity.
    • ensureCapacity

      public final void ensureCapacity(int minCapacity)
      Ensures that the vector has at least the specified capacity.
      Parameters:
      minCapacity - the desired minimum capacity
    • write

      public void write(int val)
      Specified by:
      write in class OutputStream
    • writeAt

      public void writeAt(int index, long val, int width)
    • append

      public void append(long val, int width)