use of uk.me.parabola.imgfmt.MapFailedException in project mkgmap by openstreetmap.
the class FileBackedImgFileWriter method putChar.
/**
* Write out two bytes. Can't use writeChar() since need to reverse the byte
* order.
*
* @param c The value to write.
*/
public void putChar(char c) {
try {
file.write(c);
file.write(c >> 8);
} catch (IOException e) {
throw new MapFailedException("could not write char to mdr tmp file");
}
}
use of uk.me.parabola.imgfmt.MapFailedException in project mkgmap by openstreetmap.
the class FileBackedImgFileWriter method putN.
/**
* Write out 1-4 bytes. Done in the correct byte order.
*
* @param nBytes The number of bytes to write.
* @param val The value to write.
*/
public void putN(int nBytes, int val) {
try {
file.write(val);
if (nBytes <= 1)
return;
file.write(val >> 8);
if (nBytes <= 2)
return;
file.write(val >> 16);
if (nBytes <= 3)
return;
file.write(val >> 24);
} catch (IOException e) {
throw new MapFailedException("could not write put3 to mdr tmp file");
}
}
use of uk.me.parabola.imgfmt.MapFailedException in project mkgmap by openstreetmap.
the class FileBackedImgFileWriter method put.
/**
* Write out a complete byte buffer.
*
* @param src The buffer to write.
*/
public void put(ByteBuffer src) {
try {
file.flush();
tmpChannel.write(src);
} catch (IOException e) {
throw new MapFailedException("could not write buffer to mdr tmp file");
}
}
use of uk.me.parabola.imgfmt.MapFailedException in project mkgmap by openstreetmap.
the class FileBackedImgFileWriter method put2.
/**
* Write out int in range 0..65535 as two bytes in correct byte order.
* Use instead of putChar() for unsigned for clarity.
* @param val The value to write.
*/
public void put2(int val) {
assert val >= 0 && val <= 65535 : val;
try {
file.write(val);
file.write(val >> 8);
} catch (IOException e) {
throw new MapFailedException("could not write 2 bytes to mdr tmp file");
}
}
use of uk.me.parabola.imgfmt.MapFailedException in project mkgmap by openstreetmap.
the class FileCopier method init.
public void init(CommandArgs args) {
areaName = args.get("area-name", null);
mapsetName = args.get("mapset-name", "OSM map set");
overallDescription = args.getDescription();
outputDir = args.getOutputDir();
hideGmapsuppOnPC = args.get("hide-gmapsupp-on-pc", false);
productVersion = args.get("product-version", 100);
mdrConfig = new MdrConfig();
mdrConfig.setIndexOptions(args);
try {
imgFs = createGmapsupp();
} catch (FileNotWritableException e) {
throw new MapFailedException("Could not create gmapsupp.img file");
}
}
Aggregations