use of uk.me.parabola.imgfmt.app.labelenc.DecodedText in project mkgmap by openstreetmap.
the class LBLFileReader method saveLabel.
/**
* We have a label and we need to save it.
*
* @param labelOffset The offset of the label we are about to save.
* @param currentOffset The current offset that last read from.
* @param multiplier The label offset multiplier.
* @return The offset of the next label.
*/
private int saveLabel(int labelOffset, int currentOffset, int multiplier) {
DecodedText encText = textDecoder.getText();
String text = encText.getText();
Label label = new Label(text);
assert (labelOffset & (multiplier - 1)) == 0;
int adustedOffset = labelOffset / multiplier;
label.setOffset(adustedOffset);
labels.put(adustedOffset, label);
// inside the decoder.
return currentOffset + 1 + encText.getOffsetAdjustment();
}
use of uk.me.parabola.imgfmt.app.labelenc.DecodedText in project mkgmap by openstreetmap.
the class TREFileReader method getMapInfo.
public String[] getMapInfo(int codePage) {
CodeFunctions funcs = CodeFunctions.createEncoderForLBL(0, codePage);
CharacterDecoder decoder = funcs.getDecoder();
// First do the ones in the TRE header gap
ImgFileReader reader = getReader();
reader.position(header.getHeaderLength());
List<String> msgs = new ArrayList<>();
while (reader.position() < header.getHeaderLength() + header.getMapInfoSize()) {
byte[] m = reader.getZString();
decoder.reset();
for (byte b : m) decoder.addByte(b);
DecodedText text = decoder.getText();
String text1 = text.getText();
msgs.add(text1);
}
return msgs.toArray(new String[msgs.size()]);
}
Aggregations