com.sun.tools.javac.util
Class ByteBuffer

java.lang.Object
  extended by com.sun.tools.javac.util.ByteBuffer

public class ByteBuffer
extends java.lang.Object

A byte buffer is a flexible array which grows when elements are appended. There are also methods to append names to byte buffers and to convert byte buffers to names.

This is NOT part of any API supported by Sun Microsystems. If you write code that depends on this, you do so at your own risk. This code and its internal interfaces are subject to change or deletion without notice.


Field Summary
 byte[] elems
          An array holding the bytes in this buffer; can be grown.
 int length
          The current number of defined bytes in this buffer.
 
Constructor Summary
ByteBuffer()
          Create a new byte buffer.
ByteBuffer(int initialSize)
          Create a new byte buffer with an initial elements array of given size.
 
Method Summary
 void appendByte(int b)
          Append byte to this buffer.
 void appendBytes(byte[] bs)
          Append all bytes from given byte array.
 void appendBytes(byte[] bs, int start, int len)
          Append `len' bytes from byte array, starting at given `start' offset.
 void appendChar(int x)
          Append a character as a two byte number.
 void appendDouble(double x)
          Append a double as a eight byte number.
 void appendFloat(float x)
          Append a float as a four byte number.
 void appendInt(int x)
          Append an integer as a four byte number.
 void appendLong(long x)
          Append a long as an eight byte number.
 void appendName(Name name)
          Append a name.
private  void copy(int size)
           
 void reset()
          Reset to zero length.
 Name toName(Names names)
          Convert contents to name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

elems

public byte[] elems
An array holding the bytes in this buffer; can be grown.


length

public int length
The current number of defined bytes in this buffer.

Constructor Detail

ByteBuffer

public ByteBuffer()
Create a new byte buffer.


ByteBuffer

public ByteBuffer(int initialSize)
Create a new byte buffer with an initial elements array of given size.

Method Detail

copy

private void copy(int size)

appendByte

public void appendByte(int b)
Append byte to this buffer.


appendBytes

public void appendBytes(byte[] bs,
                        int start,
                        int len)
Append `len' bytes from byte array, starting at given `start' offset.


appendBytes

public void appendBytes(byte[] bs)
Append all bytes from given byte array.


appendChar

public void appendChar(int x)
Append a character as a two byte number.


appendInt

public void appendInt(int x)
Append an integer as a four byte number.


appendLong

public void appendLong(long x)
Append a long as an eight byte number.


appendFloat

public void appendFloat(float x)
Append a float as a four byte number.


appendDouble

public void appendDouble(double x)
Append a double as a eight byte number.


appendName

public void appendName(Name name)
Append a name.


reset

public void reset()
Reset to zero length.


toName

public Name toName(Names names)
Convert contents to name.