DefaultSegmentWriter implements SegmentWriter { @NotNull RecordId writeString(@NotNull final String string) throws IOException { return new SegmentWriteOperation(writeOperationHandler.getGCGeneration()) .writeString(string); } DefaultSegmentWriter(
            @NotNull SegmentStore store,
            @NotNull SegmentReader reader,
            @NotNull SegmentIdProvider idProvider,
            @Nullable BlobStore blobStore,
            @NotNull WriterCacheManager cacheManager,
            @NotNull WriteOperationHandler writeOperationHandler
    ); @Override void flush(); @Override @NotNull RecordId writeBlob(@NotNull final Blob blob); @Override @NotNull RecordId writeStream(@NotNull final InputStream stream); @Override @NotNull RecordId writeNode(@NotNull final NodeState state, @Nullable final Buffer stableIdBytes);  }
@Test public void testStringRecord() throws IOException { RecordId empty = writer.writeString(""); RecordId space = writer.writeString(" "); RecordId hello = writer.writeString("Hello, World!"); StringBuilder builder = new StringBuilder(); for (int i = 0; i < 2 * Segment.MAX_SEGMENT_SIZE + 1000; i++) { builder.append((char) ('0' + i % 10)); } RecordId large = writer.writeString(builder.toString()); Segment segment = large.getSegmentId().getSegment(); assertEquals("", store.fileStore().getReader().readString(empty)); assertEquals(" ", store.fileStore().getReader().readString(space)); assertEquals("Hello, World!", store.fileStore().getReader().readString(hello)); assertEquals(builder.toString(), store.fileStore().getReader().readString(large)); }