| 1 | /* |
| 2 | * Copyright (C) 2009. |
| 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 3 or |
| 6 | * version 2 as published by the Free Software Foundation. |
| 7 | * |
| 8 | * This program is distributed in the hope that it will be useful, but |
| 9 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 11 | * General Public License for more details. |
| 12 | */ |
| 13 | package uk.me.parabola.imgfmt.app.labelenc; |
| 14 | |
| 15 | import java.nio.charset.Charset; |
| 16 | |
| 17 | /** |
| 18 | * Holds information about a label that has been read in from an img file. |
| 19 | * |
| 20 | * @author Steve Ratcliffe |
| 21 | */ |
| 22 | public class DecodedText { |
| 23 | /** The actual text as a proper java string */ |
| 24 | private final String text; |
| 25 | |
| 26 | /** |
| 27 | * Used during reading, the offset of the next label is at next byte that |
| 28 | * is added to the decoder plus this value. The value is usually negative |
| 29 | * or zero. |
| 30 | */ |
| 31 | private int offsetAdjustment; |
| 32 | |
| 33 | public DecodedText(byte[] ba, Charset charSet) { |
| 34 | text = new String(ba, 0, ba.length, charSet); |
| 35 | } |
| 36 | |
| 37 | |
| 38 | public String getText() { |
| 39 | return text; |
| 40 | } |
| 41 | |
| 42 | public int getOffsetAdjustment() { |
| 43 | return offsetAdjustment; |
| 44 | } |
| 45 | |
| 46 | public void setOffsetAdjustment(int offsetAdjustment) { |
| 47 | this.offsetAdjustment = offsetAdjustment; |
| 48 | } |
| 49 | } |