public void unpack(File file) throws IOException { //if the file is an archive, unpack it VFSWorker vfs = new VFSWorker(); if (vfs.canHandle(file)) { LOGGER.fine("unpacking " + file.getAbsolutePath() + " to " + this.file.getAbsolutePath()); vfs.extractTo(file, this.file); LOGGER.fine("deleting " + file.getAbsolutePath()); if (!file.delete()) { throw new IOException("unable to delete file"); } } }
public void unpack(File file) throws IOException { // if the file is an archive, unpack it VFSWorker vfs = new VFSWorker(); if (vfs.canHandle(file)) { LOGGER.fine( "unpacking " + file.getAbsolutePath() + " to " + this.file.getAbsolutePath()); vfs.extractTo(file, this.file); LOGGER.fine("deleting " + file.getAbsolutePath()); if (!file.delete()) { throw new IOException("unable to delete file"); } } }
public static Directory createFromArchive(File archive) throws IOException { VFSWorker vfs = new VFSWorker(); if (!vfs.canHandle(archive)) { throw new IOException(archive.getPath() + " is not a recognizable format"); } String basename = FilenameUtils.getBaseName(archive.getName()); File dir = new File(archive.getParentFile(), basename); int i = 0; while (dir.exists()) { dir = new File(archive.getParentFile(), basename + i++); } vfs.extractTo(archive, dir); return new Directory(dir); }
public static Directory createFromArchive(File archive) throws IOException { VFSWorker vfs = new VFSWorker(); if (!vfs.canHandle(archive)) { throw new IOException(archive.getPath() + " is not a recognizable format"); } String basename = FilenameUtils.getBaseName(archive.getName()); File dir = new File(archive.getParentFile(), basename); int i = 0; while (dir.exists()) { dir = new File(archive.getParentFile(), basename + i++); } vfs.extractTo(archive, dir); return new Directory(dir); }
public static FileData createFromFile(File file) throws IOException { if (file.isDirectory()) { return new Directory(file); } if (new VFSWorker().canHandle(file)) { return new Archive(file); } return new SpatialFile(file); } public File getFile() {
public static FileData createFromFile(File file) throws IOException { if (file.isDirectory()) { return new Directory(file); } if (new VFSWorker().canHandle(file)) { return new Archive(file); } return new SpatialFile(file); }