de.vdheide.mp3
Class ByteBuilder

java.lang.Object
  extended byde.vdheide.mp3.ByteBuilder

public class ByteBuilder
extends java.lang.Object

This does the opposite of Parser, i.e. it takes Strings or byte array, parses them and adds them to a byte array.

Text encoding is set with one of the constants:


Field Summary
static byte ISO
          Encoding ISO-8859-1
static byte NONE
          No encoding byte, assume ISO-8859-1
static byte UNICODE
          Encoding Unicode
 
Constructor Summary
ByteBuilder(byte encoding)
          Creates a new instance
ByteBuilder(byte encoding, int size)
          Creates a new instance with an estimation of the size needed.
 
Method Summary
 byte[] getBytes()
          Read contents as byte array
 void put(byte put)
          Append a single byte.
 void put(byte[] put)
          Append the contents of a byte array.
 void put(java.lang.String put)
          Append a text according to the selected encoding
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NONE

public static final byte NONE
No encoding byte, assume ISO-8859-1

See Also:
Constant Field Values

ISO

public static final byte ISO
Encoding ISO-8859-1

See Also:
Constant Field Values

UNICODE

public static final byte UNICODE
Encoding Unicode

See Also:
Constant Field Values
Constructor Detail

ByteBuilder

public ByteBuilder(byte encoding)
Creates a new instance

Parameters:
encoding - Encoding to use (see above)

ByteBuilder

public ByteBuilder(byte encoding,
                   int size)
Creates a new instance with an estimation of the size needed. It is most efficient when this estimation is the real size, but it creates no error if it is not.

Text encoding is set with one of the constants: NONE: ISO-8859-1 and no encoding byte ISO: ISO-8859-1 and encoding byte UNICODE: Unicode and encoding byte

Parameters:
encoding - Encoding to use (see above)
size - Size estimate
Method Detail

put

public void put(byte put)
Append a single byte.

Parameters:
put - Byte to insert

put

public void put(byte[] put)
Append the contents of a byte array.

Parameters:
put - Byte array to insert

put

public void put(java.lang.String put)
Append a text according to the selected encoding

Parameters:
put - Text to write

getBytes

public byte[] getBytes()
Read contents as byte array

Returns:
contents