javaFlacEncoder
Class UTF8Modified

java.lang.Object
  extended by javaFlacEncoder.UTF8Modified

public class UTF8Modified
extends java.lang.Object

This is a utility class that provides methods to both encode to and decode from the extended version of UTF8 used by the FLAC format. All functions should work with standard UTF8 as well, since this only extends it to handle larger input values.

Author:
Preston Lacey

Field Summary
static int DEBUG_LEV
          For debugging: Higher value equals more output, generally by increments of 10
 
Constructor Summary
UTF8Modified()
          Constructor.
 
Method Summary
static byte[] convertToExtendedUTF8(long value)
          Convert a value to an extended UTF8 format(as used in FLAC).
static long decodeFromExtendedUTF8(byte[] input)
          Decode an extended UTF8(as used in FLAC), to a long value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG_LEV

public static int DEBUG_LEV
For debugging: Higher value equals more output, generally by increments of 10

Constructor Detail

UTF8Modified

public UTF8Modified()
Constructor. This Class provides only static methods and static fields.

Method Detail

decodeFromExtendedUTF8

public static long decodeFromExtendedUTF8(byte[] input)
Decode an extended UTF8(as used in FLAC), to a long value.

Parameters:
input - extended UTF8 encoded value.
Returns:
value represented by the UTF8 input.

convertToExtendedUTF8

public static byte[] convertToExtendedUTF8(long value)
Convert a value to an extended UTF8 format(as used in FLAC).

Parameters:
value - value to convert to extended UTF8(value must be positive and 36 bits or less in size)
Returns:
extended UTF8 encoded value(array size is equal to the number of usable bytes)