Search in sources :

Example 6 with FileNotWritableException

use of uk.me.parabola.imgfmt.FileNotWritableException 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");
    }
}
Also used : FileNotWritableException(uk.me.parabola.imgfmt.FileNotWritableException) MapFailedException(uk.me.parabola.imgfmt.MapFailedException) MdrConfig(uk.me.parabola.imgfmt.app.mdr.MdrConfig)

Example 7 with FileNotWritableException

use of uk.me.parabola.imgfmt.FileNotWritableException in project mkgmap by openstreetmap.

the class ImgFS method createInitFS.

/**
 * Set up and ImgFS that has just been created.
 *
 * @param chan The real underlying file to write to.
 * @param params The file system parameters.
 * @throws FileNotWritableException If the file cannot be written for any
 * reason.
 */
private void createInitFS(FileChannel chan, FileSystemParam params) throws FileNotWritableException {
    readOnly = false;
    this.fsparam = params;
    // The block manager allocates blocks for files.
    headerBlockManager = new BlockManager(params.getBlockSize(), 0);
    headerBlockManager.setMaxBlock(params.getReservedDirectoryBlocks());
    // it already existing, so it is created by hand.
    try {
        directory = new Directory(headerBlockManager);
        Dirent ent = directory.create(DIRECTORY_FILE_NAME, headerBlockManager);
        ent.setSpecial(true);
        ent.setInitialized(true);
        FileNode f = new FileNode(chan, ent, "w");
        directory.setFile(f);
        header = new ImgHeader(f);
        header.createHeader(params);
    } catch (FileExistsException e) {
        throw new FileNotWritableException("Could not create img file directory", e);
    }
    fileBlockManager = new BlockManager(params.getBlockSize(), params.getReservedDirectoryBlocks());
    assert header != null;
}
Also used : FileNotWritableException(uk.me.parabola.imgfmt.FileNotWritableException) FileExistsException(uk.me.parabola.imgfmt.FileExistsException)

Aggregations

FileNotWritableException (uk.me.parabola.imgfmt.FileNotWritableException)7 FileExistsException (uk.me.parabola.imgfmt.FileExistsException)5 FileSystemParam (uk.me.parabola.imgfmt.FileSystemParam)3 Map (uk.me.parabola.imgfmt.app.map.Map)3 ExitException (uk.me.parabola.imgfmt.ExitException)2 MapFailedException (uk.me.parabola.imgfmt.MapFailedException)2 Sort (uk.me.parabola.imgfmt.app.srt.Sort)2 MapBuilder (uk.me.parabola.mkgmap.build.MapBuilder)2 IOException (java.io.IOException)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 Area (uk.me.parabola.imgfmt.app.Area)1 MdrConfig (uk.me.parabola.imgfmt.app.mdr.MdrConfig)1 SRTFile (uk.me.parabola.imgfmt.app.srt.SRTFile)1 Subdivision (uk.me.parabola.imgfmt.app.trergn.Subdivision)1 Zoom (uk.me.parabola.imgfmt.app.trergn.Zoom)1 ImgChannel (uk.me.parabola.imgfmt.fs.ImgChannel)1 FileImgChannel (uk.me.parabola.imgfmt.sys.FileImgChannel)1