@Override public void open(GenericInputSplit split) throws IOException { if(!(split instanceof ExternalProcessInputSplit)) { throw new IOException("Invalid InputSplit type."); } ExternalProcessInputSplit epSplit = (ExternalProcessInputSplit)split; // check if process command is valid string if(epSplit.getExternalProcessCommand() != null && !epSplit.getExternalProcessCommand().equals("")) { try { // run the external process this.extProc = Runtime.getRuntime().exec(epSplit.getExternalProcessCommand()); } catch (IOException e) { throw new IOException("IO Exception when starting external process: "+epSplit.getExternalProcessCommand()); } // connect streams to stdout and stderr this.extProcOutStream = this.extProc.getInputStream(); this.extProcErrStream = this.extProc.getErrorStream(); } else { throw new IllegalArgumentException("External Process Command not set"); } }