Package opennlp.tools.formats
Class DirectorySampleStream
java.lang.Object
opennlp.tools.formats.DirectorySampleStream
- All Implemented Interfaces:
- AutoCloseable,- ObjectStream<File>
The directory sample stream allows for creating an 
ObjectStream<File>
 from a directory listing of files.- 
Constructor SummaryConstructorsConstructorDescriptionDirectorySampleStream(File[] dirs, FileFilter fileFilter, boolean recursive) Initializes aDirectorySampleStream.DirectorySampleStream(File dir, FileFilter fileFilter, boolean recursive) Initializes aDirectorySampleStream.
- 
Method SummaryModifier and TypeMethodDescriptionvoidclose()Closes theObjectStreamand releases all allocated resources.read()Returns the nextObjectStreamobject.voidreset()Repositions the stream at the beginning and the previously seen object sequence will be repeated exactly.
- 
Constructor Details- 
DirectorySampleStreamInitializes aDirectorySampleStream.- Parameters:
- dirs- The- directoriesto read.
- fileFilter- The- filterto apply while enumerating files.
- recursive- Enables or disables recursive file listing.
- Throws:
- IllegalArgumentException- Thrown if one element in- dirsis not a directory.
 
- 
DirectorySampleStreamInitializes aDirectorySampleStream.- Parameters:
- dir- The- directoryto read.
- fileFilter- The- filterto apply while enumerating files.
- recursive- Enables or disables recursive file listing.
- Throws:
- IllegalArgumentException- Thrown if- diris not a directory.
 
 
- 
- 
Method Details- 
readDescription copied from interface:ObjectStreamReturns the nextObjectStreamobject. Calling this method repeatedly until it returnsnullwill return each object from the underlying source exactly once.- Specified by:
- readin interface- ObjectStream<File>
- Returns:
- The next object or nullto signal that the stream is exhausted.
- Throws:
- IOException- Thrown if there is an error during reading.
 
- 
resetpublic void reset()Description copied from interface:ObjectStreamRepositions the stream at the beginning and the previously seen object sequence will be repeated exactly. This method can be used to re-read the stream if multiple passes over the objects are required.The implementation of this method is optional. - Specified by:
- resetin interface- ObjectStream<File>
 
- 
closeCloses theObjectStreamand releases all allocated resources. After close was called, it's not allowed to callObjectStream.read()orObjectStream.reset(). Calling this function has no effect on the stream.- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- ObjectStream<File>
- Throws:
- IOException- Thrown if there is an error during closing the stream.
 
 
-