BdioWriter implements Closeable { public void next(Map<String, Object> node) throws IOException { checkState(started.get(), "not started"); byte[] serializedNode = JsonUtils.toPrettyString(node).replace("\n", "\n ").getBytes(UTF_8); if (remaining.addAndGet((delimiter.length + serializedNode.length) * -1) > 0L) { out.write(delimiter); out.write(serializedNode); } else { nextEntry(); if (remaining.addAndGet(serializedNode.length * -1) > 0L) { out.write(serializedNode); } else { throw new EntrySizeViolationException(null, Math.abs(remaining.get()) + Bdio.MAX_ENTRY_SIZE); } } } BdioWriter(BdioMetadata metadata, StreamSupplier entryStreams); void start(); void next(Map<String, Object> node); @Override void close(); void closeEntry();  }
@Test(expected = IllegalStateException.class) public void noStart() throws IOException { try (BdioWriter writer = new BdioWriter(metadata, NULL_STREAM_SUPPLIER)) { writer.next(new HashMap<>()); } }