Package blbutil
Interface FileIt<E>
-
- Type Parameters:
E- the type of the elements returned by this iterator'snext()method.
- All Superinterfaces:
java.lang.AutoCloseable,java.io.Closeable,java.util.Iterator<E>
- All Known Subinterfaces:
SampleFileIt<E>
public interface FileIt<E> extends java.util.Iterator<E>, java.io.CloseableAn iterator for data elements in a file. If an IOExceptions is thrown while reading a file, the IOException is trapped, an appropriate error message is written to standard out, and the Java Virtual Machine is terminated. The
When theIterator.remove()method is unsupported and throws anUnsupportedOperationException.FileIteratorobject is no longer needed, theclose()method should be invoked to release any system resources controlled by the object. After callingclose(), invokinghasNext()returnsfalse, and invokingnext()will throw aNoSuchElementException.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()Terminates the iteration and releases any system resources that are held by this object.java.io.Filefile()Returns the file from which the data are read, ornullif the data are read from standard input or are computed data.java.lang.StringtoString()Returns a string representation ofthis.
-
-
-
Method Detail
-
file
java.io.File file()
Returns the file from which the data are read, ornullif the data are read from standard input or are computed data.- Returns:
- the file from which the data are read, or
nullif the data are read from standard input or are computed data
-
close
void close()
Terminates the iteration and releases any system resources that are held by this object. After invokingclose(), further invocations ofclose()have no effect.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable
-
toString
java.lang.String toString()
Returns a string representation ofthis. The exact details of the representation are unspecified and subject to change.- Overrides:
toStringin classjava.lang.Object- Returns:
- a string representation of
this
-
-