@Override
    public int read(char[] cbuf, int off, int len) throws IOException {
        if (throwable instanceof ZeroByteFileException) {
            return -1;
        } else if (throwable instanceof IOException) {
            throw (IOException) throwable;
        } else if (throwable != null) {
            throw new IOException("", throwable);
        }
        return reader.read(cbuf, off, len);
    }
Reads parsed text from the pipe connected to the parsing thread.
Fails if the parsing thread has thrown an exception.

@param cbuf character buffer
@param off  start offset within the buffer
@param len  maximum number of characters to read
@throws IOException if the parsing thread has failed or
                    if for some reason the pipe does not work properly
tika-core/src/main/java/org/apache/tika/parser/ParsingReader.java