@Test public void testEntriesWithoutEof() throws IOException { ByteArrayOutputStream innerStream = new ByteArrayOutputStream(); try(ObjectEntryWriter writer = new ObjectEntryWriter(innerStream)) { writer.write(new ObjectEntry("file1", 10L)); writer.write(new ObjectEntry("file2", 20L)); } assertThat(innerStream.toInputStream()).hasContent( "{\"objectId\":\"file1\",\"size\":10}\n" + "{\"objectId\":\"file2\",\"size\":20}"); }
public void write(ObjectEntry objectEntry) throws IOException { ParametersChecker.checkParameter(""); ensureNotClosed(); ensureNotEof(); if (!isEmpty) { writer.append("\n"); } isEmpty = false; writer.write(JsonHandler.unprettyPrint(objectEntry)); }
ObjectEntryWriter implements AutoCloseable { public void write(ObjectEntry objectEntry) throws IOException { ParametersChecker.checkParameter(""); ensureNotClosed(); ensureNotEof(); if (!isEmpty) { writer.append("\n"); } isEmpty = false; writer.write(JsonHandler.unprettyPrint(objectEntry)); } }
ObjectEntryWriter implements AutoCloseable { public void write(ObjectEntry objectEntry) throws IOException { ParametersChecker.checkParameter(""); ensureNotClosed(); ensureNotEof(); if (!isEmpty) { writer.append("\n"); } isEmpty = false; writer.write(JsonHandler.unprettyPrint(objectEntry)); } ObjectEntryWriter(OutputStream ouputStream); }
ObjectEntryWriter implements AutoCloseable { public void write(ObjectEntry objectEntry) throws IOException { ParametersChecker.checkParameter(""); ensureNotClosed(); ensureNotEof(); if (!isEmpty) { writer.append("\n"); } isEmpty = false; writer.write(JsonHandler.unprettyPrint(objectEntry)); } ObjectEntryWriter(OutputStream ouputStream); void write(ObjectEntry objectEntry); void writeEof(); @Override void close(); }
ObjectEntryWriter implements AutoCloseable { public void write(ObjectEntry objectEntry) throws IOException { ParametersChecker.checkParameter(""); ensureNotClosed(); ensureNotEof(); if (!isEmpty) { writer.append("\n"); } isEmpty = false; writer.write(JsonHandler.unprettyPrint(objectEntry)); } ObjectEntryWriter(OutputStream ouputStream); void write(ObjectEntry objectEntry); void writeEof(); @Override void close();  }