@Test public void testReset() throws IOException { try (ParagraphStream paraStream = new ParagraphStream( ObjectStreamUtils.createObjectStream("1", "2", "", "", "4", "5", ""))) { Assert.assertEquals("1\n2\n", paraStream.read()); paraStream.reset(); Assert.assertEquals("1\n2\n", paraStream.read()); Assert.assertEquals("4\n5\n", paraStream.read()); Assert.assertNull(paraStream.read()); } }
public String read() throws IOException { StringBuilder paragraph = new StringBuilder(); while (true) { String line = samples.read(); if (line == null || line.equals("")) { if (paragraph.length() > 0) { return paragraph.toString(); } } else { paragraph.append(line).append('\n'); } if (line == null) return null; } }
ParagraphStream extends FilterObjectStream<String, String> { public String read() throws IOException { StringBuilder paragraph = new StringBuilder(); while (true) { String line = samples.read(); if (line == null || line.equals("")) { if (paragraph.length() > 0) { return paragraph.toString(); } } else { paragraph.append(line).append('\n'); } if (line == null) return null; } } }
ParagraphStream extends FilterObjectStream<String, String> { public String read() throws IOException { StringBuilder paragraph = new StringBuilder(); while (true) { String line = samples.read(); if (line == null || line.equals("")) { if (paragraph.length() > 0) { return paragraph.toString(); } } else { paragraph.append(line).append('\n'); } if (line == null) return null; } } ParagraphStream(ObjectStream<String> lineStream); }
ParagraphStream extends FilterObjectStream<String, String> { public String read() throws IOException { StringBuilder paragraph = new StringBuilder(); while (true) { String line = samples.read(); if (line == null || line.equals("")) { if (paragraph.length() > 0) { return paragraph.toString(); } } else { paragraph.append(line).append('\n'); } if (line == null) return null; } } ParagraphStream(ObjectStream<String> lineStream); String read(); }
ParagraphStream extends FilterObjectStream<String, String> { public String read() throws IOException { StringBuilder paragraph = new StringBuilder(); while (true) { String line = samples.read(); if (line == null || line.equals("")) { if (paragraph.length() > 0) { return paragraph.toString(); } } else { paragraph.append(line).append('\n'); } if (line == null) return null; } } ParagraphStream(ObjectStream<String> lineStream); String read();  }