@Test public void iterator_using_supplier() throws Exception { try (FileChannel fd = FileChannel.open(tmpfile, READ)) { XdrStreamIterator iter = new XdrStreamIterator(new BufferSupplier() { @Override public void load(ByteBuffer buf) throws IOException { fd.read(buf); } @Override public boolean atEof() throws IOException { return fd.position() == fd.size(); } }); assertTrue(fd.position() > 0); assertTrue(iter.hasNext()); List<TimeSeriesCollection> read_tsdata = new ArrayList<>(); iter.forEachRemaining(read_tsdata::add); assertTrue(fd.position() == fd.size()); assertEquals(tsdata, read_tsdata); } }
@Override public boolean hasNext() { try { LOG.log(Level.FINEST, "hasNext: {0}, counter: {1}", new Object[]{!data_.atEof(), counter_}); return !data_.atEof(); } catch (IOException ex) { LOG.log(Level.SEVERE, "error accessing data file", ex); return true; } }
XdrStreamIterator implements Iterator<TimeSeriesCollection> { @Override public boolean hasNext() { try { LOG.log(Level.FINEST, "hasNext: {0}, counter: {1}", new Object[]{!data_.atEof(), counter_}); return !data_.atEof(); } catch (IOException ex) { LOG.log(Level.SEVERE, "error accessing data file", ex); return true; } } }
XdrStreamIterator implements Iterator<TimeSeriesCollection> { @Override public boolean hasNext() { try { LOG.log(Level.FINEST, "hasNext: {0}, counter: {1}", new Object[]{!data_.atEof(), counter_}); return !data_.atEof(); } catch (IOException ex) { LOG.log(Level.SEVERE, "error accessing data file", ex); return true; } } XdrStreamIterator(XdrBufferDecodingStream data);  XdrStreamIterator(BufferSupplier data);  XdrStreamIterator(ByteBuffer buf, BufferSupplier data);  XdrStreamIterator(ByteBuffer data); }
XdrStreamIterator implements Iterator<TimeSeriesCollection> { @Override public boolean hasNext() { try { LOG.log(Level.FINEST, "hasNext: {0}, counter: {1}", new Object[]{!data_.atEof(), counter_}); return !data_.atEof(); } catch (IOException ex) { LOG.log(Level.SEVERE, "error accessing data file", ex); return true; } } XdrStreamIterator(XdrBufferDecodingStream data);  XdrStreamIterator(BufferSupplier data);  XdrStreamIterator(ByteBuffer buf, BufferSupplier data);  XdrStreamIterator(ByteBuffer data); @Override boolean hasNext(); @Override TimeSeriesCollection next(); }
XdrStreamIterator implements Iterator<TimeSeriesCollection> { @Override public boolean hasNext() { try { LOG.log(Level.FINEST, "hasNext: {0}, counter: {1}", new Object[]{!data_.atEof(), counter_}); return !data_.atEof(); } catch (IOException ex) { LOG.log(Level.SEVERE, "error accessing data file", ex); return true; } } XdrStreamIterator(XdrBufferDecodingStream data);  XdrStreamIterator(BufferSupplier data);  XdrStreamIterator(ByteBuffer buf, BufferSupplier data);  XdrStreamIterator(ByteBuffer data); @Override boolean hasNext(); @Override TimeSeriesCollection next();  }