Code example for PipedInputStream

0
 
	private void feedIntoParser(byte[] data, int offset, int length) throws IOException {
		if (!parserStarted) {
			parserStarted = true;
			XMLTestReportParser parser = new XMLTestReportParser(this, this);
			PipedInputStream input = new PipedInputStream();
			buffer = new PipedOutputStream();
			buffer.connect(input);
            // A small fix; we always need a root element, but the test framework will not give that to us. 
            buffer.write("<root>\n".getBytes());
			parser.parse(input);
		} 
		 
		buffer.write(data, offset, length);
	} 
 
	public void processStarted(int id) {
	} 
 
	public void processStopped(int id) {
		try {