protected InputSource getInputSource(final InputSource inputSource) throws IOException {
        // Set the character encoding to use.
        String charsetName = StreamUtil.DEFAULT_CHARSET_NAME;
        if (inputSource.getEncoding() != null && inputSource.getEncoding().trim().length() > 0) {
            charsetName = inputSource.getEncoding();
        }

        InputSource internalInputSource;

        // If the input source is not raw bytes then assume that the user has
        // added the appropriate readers to the byte
        // stream and provided a character reader.
        if (inputSource.getCharacterStream() != null) {
            if (inputSource.getCharacterStream() instanceof BufferedReader) {
                internalInputSource = new InputSource(inputSource.getCharacterStream());
            } else {
                internalInputSource = new InputSource(new BufferedReader(inputSource.getCharacterStream()));
            }
        } else {
            final Reader inputStreamReader = new InputStreamReader(inputSource.getByteStream(), charsetName);
            final BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
            internalInputSource = new InputSource(bufferedReader);
        }

        internalInputSource.setEncoding(charsetName);
        return internalInputSource;
    }
Provide a chance for parser implementations to modify or wrap the input
source.
stroom-pipeline/src/main/java/stroom/pipeline/parser/AbstractParser.java