/** Wraps a file given by a {@link File} object into an iterator. * * @param file a file. */ public static ByteIterator asByteIterator(final File file) throws IOException { return new ByteDataInputWrapper(new DataInputStream(new FastBufferedInputStream(new FileInputStream(file)))); } /** Wraps a file given by a pathname into an iterator.
@Override public byte nextByte() { if (! hasNext()) throw new NoSuchElementException(); toAdvance = true; return next; } }
/** Wraps the given data input stream into an iterator. * * @param dataInput a data input. */ public static ByteIterator asByteIterator(final DataInput dataInput) { return new ByteDataInputWrapper(dataInput); } /** Wraps a file given by a {@link File} object into an iterator.