@Override public void initializeDriver() { // Where are the input files? String dirName = getParam("japex.inputDir"); if (dirName == null) { throw new RuntimeException("japex.inputFile not specified"); } _inputDir = new File(dirName); if (!_inputDir.exists() || !_inputDir.isDirectory()) { throw new IllegalArgumentException( "No input directory '" + _inputDir.getAbsolutePath() + "'"); } _streaming = getBooleanParam("streaming"); }
protected byte[] loadFile(File file) throws IOException { FileInputStream in = new FileInputStream(file); ByteArrayOutputStream out = new ByteArrayOutputStream((int) file.length()); byte[] buffer = new byte[4000]; int count; while ((count = in.read(buffer)) > 0) { out.write(buffer, 0, count); } in.close(); out.close(); return out.toByteArray(); }