Search in sources :

Example 1 with CharacterDecoder

use of uk.me.parabola.imgfmt.app.labelenc.CharacterDecoder 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()]);
}
Also used : CharacterDecoder(uk.me.parabola.imgfmt.app.labelenc.CharacterDecoder) DecodedText(uk.me.parabola.imgfmt.app.labelenc.DecodedText) ArrayList(java.util.ArrayList) ImgFileReader(uk.me.parabola.imgfmt.app.ImgFileReader) BufferedImgFileReader(uk.me.parabola.imgfmt.app.BufferedImgFileReader) CodeFunctions(uk.me.parabola.imgfmt.app.labelenc.CodeFunctions)

Aggregations

ArrayList (java.util.ArrayList)1 BufferedImgFileReader (uk.me.parabola.imgfmt.app.BufferedImgFileReader)1 ImgFileReader (uk.me.parabola.imgfmt.app.ImgFileReader)1 CharacterDecoder (uk.me.parabola.imgfmt.app.labelenc.CharacterDecoder)1 CodeFunctions (uk.me.parabola.imgfmt.app.labelenc.CodeFunctions)1 DecodedText (uk.me.parabola.imgfmt.app.labelenc.DecodedText)1