/** * Validate the (local) ouput from an String and return the corresponding * file. * * @param out * where the file will go * @param overwrite * whether to overwrite existing files * @return the output file location, deleted if it is allowed to be deleted * @throws IOException * if the file exists, but can't be deleted */ public static File validateLocalOutput(String out, boolean overwrite) throws IOException { return validateLocalOutput(out, overwrite, false); }
/** * Validate the (local) ouput from an String and return the corresponding * file. * * @param out * where the file will go * @param overwrite * whether to overwrite existing files * @return the output file location, deleted if it is allowed to be deleted * @throws IOException * if the file exists, but can't be deleted */ public static File validateLocalOutput(String out, boolean overwrite) throws IOException { return validateLocalOutput(out, overwrite, false); }
private static Connection prepareDBSQLite(String location) throws SQLException, ClassNotFoundException, IOException { // load the sqlite-JDBC driver using the current class loader Class.forName("org.sqlite.JDBC"); FileToolsUtil.validateLocalOutput(location, true, false); Connection connection = null; connection = DriverManager.getConnection("jdbc:sqlite:" + location); return connection; }
private static Connection prepareDBSQLite(String location) throws SQLException, ClassNotFoundException, IOException { // load the sqlite-JDBC driver using the current class loader Class.forName("org.sqlite.JDBC"); FileToolsUtil.validateLocalOutput(location, true, false); Connection connection = null; connection = DriverManager.getConnection("jdbc:sqlite:" + location); return connection; }
/** * Validate the (local) ouput from an {@link InOutToolOptions} and return * the corresponding file. * * @param tool * the tool from which to get settings * @return the output file location, deleted if it is allowed to be deleted * @throws IOException * if the file exists, but can't be deleted */ public static File validateLocalOutput(InOutToolOptions tool) throws IOException { return validateLocalOutput(tool.output, tool.isForce(), tool.contin); }
/** * Validate the (local) ouput from an {@link InOutToolOptions} and return * the corresponding file. * * @param tool * the tool from which to get settings * @return the output file location, deleted if it is allowed to be deleted * @throws IOException * if the file exists, but can't be deleted */ public static File validateLocalOutput(InOutToolOptions tool) throws IOException { return validateLocalOutput(tool.output, tool.isForce(), tool.contin); }
private static void saveSEQFileVersion() throws Exception { final String seqFileSource = "/Users/ss/Development/data/flickr-all-geo-16-46M-images-maxhistogram.seq"; final String output = "/Users/ss/Development/data/flickr-all-geo-16-46M-images-maxhistogram.binary"; final File ofile = FileToolsUtil.validateLocalOutput(output, true, false); ofile.mkdirs();
private static void saveSEQFileVersion() throws Exception { final String seqFileSource = "/Users/ss/Development/data/flickr-all-geo-16-46M-images-maxhistogram.seq"; final String output = "/Users/ss/Development/data/flickr-all-geo-16-46M-images-maxhistogram.binary"; final File ofile = FileToolsUtil.validateLocalOutput(output, true, false); ofile.mkdirs();
@Override public boolean validate() throws CmdLineException{ try{ if(FileToolsUtil.isStdin(this)){ this.stdin = true; } else{ this.inputFiles = FileToolsUtil.validateLocalInput(this); } if(FileToolsUtil.isStdout(this)){ this.stdout = true; } else { this.outputFile = FileToolsUtil.validateLocalOutput(this); } return true; } catch(Exception e){ throw new CmdLineException(null,e.getMessage()); } }
@Override public boolean validate() throws CmdLineException{ try{ if(FileToolsUtil.isStdin(this)){ this.stdin = true; } else{ this.inputFiles = FileToolsUtil.validateLocalInput(this); } if(FileToolsUtil.isStdout(this)){ this.stdout = true; } else { this.outputFile = FileToolsUtil.validateLocalOutput(this); } return true; } catch(Exception e){ throw new CmdLineException(null,e.getMessage()); } }
private void validate() throws CmdLineException { if(this.getInput() == null || this.getInput() == ""){ this.setInput("/all.json"); } else if(!this.getInput().endsWith(".json")){ this.setInput(this.getInput()+".json"); } this.setOutput(this.getOutput() + File.separator + this.getInput()); try { File fileOut = FileToolsUtil.validateLocalOutput(this); fileOut.mkdirs(); } catch (IOException e) { throw new CmdLineException(null,e.getMessage()); } } }