private HexDump getHexDump(final InputStream inputStream,
                               final DataRange dataRange,
                               final String encoding,
                               final long streamSizeBytes) throws IOException {
        final HexDump hexDump;
        if (dataRange.hasBoundedStart()) {
            // The byte offset is our preferred method of setting the range
            // as it will tally exactly with the TEXT view.
            if (dataRange.getOptByteOffsetFrom().isPresent()) {
                hexDump = HexDumpUtil.hexDump(
                        inputStream,
                        HEX_DUMP_CHARSET,
                        dataRange.getByteOffsetFrom(),
                        sourceConfig.getMaxHexDumpLines());
            } else if (dataRange.getOptCharOffsetFrom().isPresent()) {
                // This is a bit of an approximate location as we don't know how the chars map to the bytes.
                final Charset charset = Charset.forName(encoding);
                final Long estimatedCharCount = estimateCharCount(streamSizeBytes, charset).getCount();
                final double relativeStartPos = dataRange.getCharOffsetFrom() / ((double) estimatedCharCount);
                final long estimatedStartByteOffset = (long) (relativeStartPos * streamSizeBytes);

                LOGGER.debug(() -> LogUtil.message(
                        "streamSizeBytes: {}, charOffsetFrom: {}, " +
                        "estimatedCharCount: {}, relativeStartPos: {}, estimatedStartByteOffset: {}",
                        streamSizeBytes,
                        dataRange.getCharOffsetFrom(),
                        estimatedCharCount,
                        relativeStartPos,
                        estimatedStartByteOffset)
                );

                hexDump = HexDumpUtil.hexDump(
                        inputStream,
                        HEX_DUMP_CHARSET,
                        estimatedStartByteOffset,
                        sourceConfig.getMaxHexDumpLines());
            } else if (dataRange.getOptLocationFrom().isPresent()) {
                LOGGER.warn("Setting hex dump location by line no is not yet supported");
                hexDump = HexDumpUtil.hexDump(
                        inputStream,
                        HEX_DUMP_CHARSET,
                        sourceConfig.getMaxHexDumpLines());
            } else {
                hexDump = HexDumpUtil.hexDump(
                        inputStream,
                        HEX_DUMP_CHARSET,
                        sourceConfig.getMaxHexDumpLines());
            }
        } else {
            hexDump = HexDumpUtil.hexDump(
                    inputStream,
                    HEX_DUMP_CHARSET,
                    sourceConfig.getMaxHexDumpLines());
        }
        return hexDump;
    }
How big our buffers are. This should always be a multiple of 8.
stroom-data/stroom-data-store-impl/src/main/java/stroom/data/store/impl/DataFetcher.java