Debian Codegraph @

src/uk/me/parabola/imgfmt/app/labelenc/CharacterDecoder.java

raw symbols SCIP
1 /*
2 * Copyright (C) 2007 Steve Ratcliffe
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 *
14 * Author: Steve Ratcliffe
15 * Create date: 14-Jan-2007
16 */
17 package uk.me.parabola.imgfmt.app.labelenc;
18
19 /**
20 * Interface for decoding characters for use in the Label section of a .img
21 * file.
22 *
23 * These things are stateful, you add bytes read from the file to them and
24 * they return a status when a complete label has been obtained. At this point
25 * you retrieve the text.
26 *
27 * @author Steve Ratcliffe
28 */
29 public interface CharacterDecoder {
30
31 /**
32 * Add a byte to this decoder. This will be saved until a complete
33 * label string has been detected.
34 *
35 * @param b The byte read from the lbl file.
36 * @return True if a label string is finished and is ready to be retrieved
37 * via the {@link #getText} method.
38 */
39 public boolean addByte(int b);
40
41 /**
42 * Get the valid text. This is guaranteed to be encoded as utf-8.
43 *
44 * @return The byte array and length as an EncodedText struct.
45 */
46 public DecodedText getText();
47
48 /**
49 * Resets the state. This should be called for example if the reader is
50 * jumping to a new place in the file and cannot guarantee that the
51 * previous label was fully read.
52 */
53 public void reset();
54 }