private Charset determineCharset(final String encoding, final BOMInputStream bomInputStream) {
        String bomCharsetName = null;
        try {
            bomCharsetName = bomInputStream.getBOMCharsetName();
            if (bomCharsetName != null && !encoding.equals(bomCharsetName)) {
                LOGGER.info("BOM charset [{}] differs from encoding [{}], using [{}]",
                        bomCharsetName, encoding, bomCharsetName);
            }
        } catch (IOException e) {
            LOGGER.warn("Error getting charset from BOM, {}", e.getMessage(), e);
        }
        return Charset.forName(Objects.requireNonNullElse(bomCharsetName, encoding));
    }
@param inputStream          The stream to read from. This reader will not close the stream.
@param includeByteOrderMark If true, any BOM in the stream will be included.
@param encoding             The character encoding name of the stream.
stroom-data/stroom-data-store-impl/src/main/java/stroom/data/store/impl/CharReader.java