| 
 | " 2013 FRC Java API" | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.squawk.ByteBufferEncoder
public final class ByteBufferEncoder
A byte buffer encoder can be used to build a byte array of values encoded
 using a space-saving encoding. The byte array can be decoded with
 a byte buffer decoder.
| Field Summary | |
|---|---|
| protected  byte[] | bufferThe data written to this buffer. | 
| protected  int | countThe amount of data written to the buffer. | 
| Constructor Summary | |
|---|---|
| ByteBufferEncoder() | |
| Method Summary | |
|---|---|
|  void | add(ByteBufferEncoder buf)Adds the contents of another ByteBuffer to this buffer. | 
|  void | addUnencodedByte(int value)Adds an unencoded byte to the buffer. | 
|  void | addUnsignedByte(int value)Adds an unsigned byte value to the buffer. | 
|  void | addUnsignedShort(int value)Adds an unsigned short value to the buffer. | 
|  void | addUtf8(String s)Adds a string to the buffer in UTF8 encoded form. | 
| protected  void | ensure(int needed)Ensures that the buffer is large enough. | 
|  void | reset()Clears the buffer. | 
|  byte[] | toByteArray()Gets the contents of this buffer as a byte array. | 
| Methods inherited from class java.lang.Object | 
|---|
| equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
protected int count
protected byte[] buffer
| Constructor Detail | 
|---|
public ByteBufferEncoder()
| Method Detail | 
|---|
public void reset()
protected final void ensure(int needed)
needed - the extra amount of data about to be writtenpublic final void addUnencodedByte(int value)
value - the byte to be added.public final void addUnsignedByte(int value)
value - the byte to be added (must be between 0 and 0xFF).public final void addUnsignedShort(int value)
value is less than
 128 otherwise the value will be encoded in 2 bytes.
value - the byte to be added (must be between 0 and 0xFFFF).public void addUtf8(String s)
addUnsignedShort(int).
s - the string to addpublic void add(ByteBufferEncoder buf)
buf is added with addUnsignedInt(int) before
 its contents are.
buf - the buffer to addpublic byte[] toByteArray()
| 
 | " 2013 FRC Java API" | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||