src/main/java/org/wymiwyg/commons/util/io/GreedyPreReadingInputStream.java
public int read() throws IOException {
		if (currentReader == null) {
			try {
				getNextReader();
			} catch (StreamFinishedException e) {
				return -1;
			}
		}
		int result = currentReader.read();
		while (result == -1) {
			try {
				getNextReader();
			} catch (StreamFinishedException e) {
				return -1;
			}
			result = currentReader.read();
		}
		return result;
	}
public int read() throws IOException {
		if (currentReader == null) {
			try {
				getNextReader();
			} catch (StreamFinishedException e) {
				return -1;
			}
		}
		int result = currentReader.read();
		while (result == -1) {
			try {
				getNextReader();
			} catch (StreamFinishedException e) {
				return -1;
			}
			result = currentReader.read();
		}
		return result;
	}
public int read ( ) throws IOException { if ( currentReader == null ) { try { getNextReader ( ) ; } catch ( StreamFinishedException e ) { return - 1 ; } } int result = currentReader . read ( ) ; while ( result == - 1 ) { try { getNextReader ( ) ; } catch ( StreamFinishedException e ) { return - 1 ; } result = currentReader . read ( ) ; } return result ; }
/*
(non-Javadoc)

@see java.io.InputStream#read()
/ * ( non - Javadoc )