private void loadNextReader() throws InvalidCommandException {
        if (!processQueue.isEmpty()) {
            try {
                if (reader != null)
                    reader.close();
            } catch (IOException e) {
            }

            try {
                logger.trace("Obtaining next reader");
                currentProcess = processQueue.getNextProcess();
                Vector<InputStream> vector = new Vector<InputStream>();
                vector.add(currentProcess.getInputStream());
                vector.add(new ByteArrayInputStream(new byte[] { '\n' }));
                vector.add(currentProcess.getErrorStream());
                vector.add(new ByteArrayInputStream(new byte[] { '\n' }));
                reader = new BufferedReader(new InputStreamReader(new SequenceInputStream(
                        vector.elements())));
            } catch (IOException e) {
                logger.error("Failed to initiate next process (exception thrown)", e);
                throw new InvalidCommandException(e.getMessage());
            }
        }
    }