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

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

public class Utf8Decoder
extends java.lang.Object
implements CharacterDecoder

Decoder for labels in utf-8, note that I am not actually sure that this is in fact used anywhere.

Author:
Steve Ratcliffe

Constructor Summary
Utf8Decoder()
           
 
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

Utf8Decoder

public Utf8Decoder()
Method Detail

addByte

public boolean addByte(int b)
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 getText() method.

getText

public DecodedText getText()
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.