use of uk.me.parabola.imgfmt.app.typ.TYPFile in project mkgmap by openstreetmap.
the class TypCompiler method writeTyp.
/**
* Write the type file out from the compiled form to the given name.
*/
private void writeTyp(TypData data, File file) throws IOException {
try (FileChannel channel = FileChannel.open(file.toPath(), StandardOpenOption.CREATE, StandardOpenOption.WRITE, StandardOpenOption.READ)) {
channel.truncate(0);
FileImgChannel w = new FileImgChannel(channel);
try (TYPFile typ = new TYPFile(w)) {
typ.setData(data);
typ.write();
}
}
}
use of uk.me.parabola.imgfmt.app.typ.TYPFile in project mkgmap by openstreetmap.
the class TypTextReaderTest method testFromFile.
/**
* Basic test, reading from a file using most features.
*/
@Test
public void testFromFile() throws IOException, InterruptedException {
Reader r = new BufferedReader(new FileReader("test/resources/typ/test.txt"));
tr = new TypTextReader();
tr.read("test.typ", r);
TestUtils.registerFile("ts__test.typ");
RandomAccessFile raf = new RandomAccessFile("ts__test.typ", "rw");
FileChannel channel = raf.getChannel();
channel.truncate(0);
try (FileImgChannel w = new FileImgChannel(channel);
TYPFile typ = new TYPFile(w)) {
typ.setData(tr.getData());
typ.write();
} finally {
raf.close();
}
}
Aggregations