uk.me.parabola.imgfmt.app.labelenc
Class AnyCharsetDecoder

java.lang.Object
  extended by uk.me.parabola.imgfmt.app.labelenc.AnyCharsetDecoder
All Implemented Interfaces:
CharacterDecoder

public class AnyCharsetDecoder
extends java.lang.Object
implements CharacterDecoder

Decodes strings from format 9 and a given character set to java strings.


Constructor Summary
AnyCharsetDecoder(java.lang.String charsetName)
           
 
Method Summary
 boolean addByte(int b)
          Add a byte to this decoder.
 DecodedText getText()
          Get the valid text.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnyCharsetDecoder

public AnyCharsetDecoder(java.lang.String charsetName)
Method Detail

addByte

public boolean addByte(int b)
Description copied from interface: CharacterDecoder
Add a byte to this decoder. This will be saved until a complete label string has been detected.

Specified by:
addByte in interface CharacterDecoder
Parameters:
b - The byte read from the lbl file.
Returns:
True if a label string is finished and is ready to be retrieved via the CharacterDecoder.getText() method.

getText

public DecodedText getText()
Description copied from interface: CharacterDecoder
Get the valid text. This is guaranteed to be encoded as utf-8.

Specified by:
getText in interface CharacterDecoder
Returns:
The byte array and length as an EncodedText struct.