@Test
    void testSimpleWriteThenRead() {
        final String text = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                "<records>" +
                "<record>text1</record>" +
                "<record>text2</record>" +
                "<record>text3</record>" +
                "</records>";
        final InputStream bais = new ByteArrayInputStream(text.getBytes(StreamUtil.DEFAULT_CHARSET));

        final ByteArrayOutputStream dataBuffer = new ByteArrayOutputStream();

        TargetUtil.write(bais, new RASegmentOutputStream(dataBuffer, ByteArrayOutputStream::new), true);

        assertThat(new String(dataBuffer.toByteArray(), StreamUtil.DEFAULT_CHARSET))
                .isEqualTo(text);
    }
Tests that the raw input segment writer is capable of determining the input
type (XML and text) correctly and that it inserts segment boundaries in the
correct places.
stroom-data/stroom-data-store-impl-fs/src/test/java/stroom/data/store/impl/fs/TestStreamTargetUtil.java