@Test public void readStream() throws Exception { try (BinaryFILEReader reader = new BinaryFILEReader(stream, messages)) { while (reader.read() >= 0); } assertEquals(asList("foo", "bar", "baz", "quux", ""), messages.collect()); }
public int read() throws IOException { int bytes = channel.read(buffer); if (bytes <= 0) return bytes; buffer.flip(); while (parse()); buffer.compact(); return bytes; }
BinaryFILEReader implements Closeable { public int read() throws IOException { int bytes = channel.read(buffer); if (bytes <= 0) return bytes; buffer.flip(); while (parse()); buffer.compact(); return bytes; } }
BinaryFILEReader implements Closeable { public int read() throws IOException { int bytes = channel.read(buffer); if (bytes <= 0) return bytes; buffer.flip(); while (parse()); buffer.compact(); return bytes; } BinaryFILEReader(InputStream stream, MessageListener listener);  BinaryFILEReader(ReadableByteChannel channel, MessageListener listener); }
BinaryFILEReader implements Closeable { public int read() throws IOException { int bytes = channel.read(buffer); if (bytes <= 0) return bytes; buffer.flip(); while (parse()); buffer.compact(); return bytes; } BinaryFILEReader(InputStream stream, MessageListener listener);  BinaryFILEReader(ReadableByteChannel channel, MessageListener listener); static BinaryFILEReader open(File file, MessageListener listener); int read(); @Override void close(); }
BinaryFILEReader implements Closeable { public int read() throws IOException { int bytes = channel.read(buffer); if (bytes <= 0) return bytes; buffer.flip(); while (parse()); buffer.compact(); return bytes; } BinaryFILEReader(InputStream stream, MessageListener listener);  BinaryFILEReader(ReadableByteChannel channel, MessageListener listener); static BinaryFILEReader open(File file, MessageListener listener); int read(); @Override void close();  }