/** * @return all the inputs from the -if options file, or the single input if * -i was not defined */ public String[] getAllInputs() { boolean multifiles = this.getInputFile() != null; File inputFileF = null; if (multifiles) { inputFileF = new File(this.getInputFile()); multifiles = inputFileF.exists() && inputFileF.canRead(); } if (!multifiles) { if (this.input == null) return null; return new String[] { this.input }; } else { try { final String[] lines = FileUtils.readlines(inputFileF); return lines; } catch (final IOException e) { if (this.input == null) return null; return new String[] { this.input }; } } }
/** * @return all the inputs from the -if options file, or the single input if * -i was not defined */ public String[] getAllInputs() { boolean multifiles = this.getInputFile() != null; File inputFileF = null; if (multifiles) { inputFileF = new File(this.getInputFile()); multifiles = inputFileF.exists() && inputFileF.canRead(); } if (!multifiles) { if (this.input == null) return null; return new String[] { this.input }; } else { try { final String[] lines = FileUtils.readlines(inputFileF); return lines; } catch (final IOException e) { if (this.input == null) return null; return new String[] { this.input }; } } }
if (tool.input == null && tool.getInputFile() == null) { throw new IOException("No valid input provided");
if (tool.input == null && tool.getInputFile() == null) { throw new IOException("No valid input provided");
/** * Test whether the input is the stdin * * @param tool * @return true if input should be stdin, false otherwise. */ public static boolean isStdin(InOutToolOptions tool) { if (tool.getInput() == null && tool.getInputFile() == null) return true; return tool.getInput() != null && tool.getInput().equals("-"); }
/** * Test whether the input is the stdin * * @param tool * @return true if input should be stdin, false otherwise. */ public static boolean isStdin(InOutToolOptions tool) { if (tool.getInput() == null && tool.getInputFile() == null) return true; return tool.getInput() != null && tool.getInput().equals("-"); }