public abstract class WordReader extends Object
| Modifier | Constructor and Description |
|---|---|
protected |
WordReader(File baseDir)
Creates a new WordReader with the given base directory.
|
protected |
WordReader(URL baseURL)
Creates a new WordReader with the given base URL.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the FileWordReader.
|
File |
getBaseDir()
Returns the base directory of this reader, if any.
|
URL |
getBaseURL()
Returns the base URL of this reader, if any.
|
void |
includeWordReader(WordReader newIncludeWordReader)
Specifies to start reading words from the given WordReader.
|
String |
lastComments()
Returns the comments collected before returning the last word.
|
protected abstract String |
lineLocationDescription()
Returns a readable description of the current WordReader position.
|
String |
locationDescription()
Constructs a readable description of the current position in this
WordReader and its included WordReader objects.
|
protected abstract String |
nextLine()
Reads a line from this WordReader, or from one of its active included
WordReader objects.
|
String |
nextWord(boolean isFileName,
boolean expectSingleFile)
Reads a word from this WordReader, or from one of its active included
WordReader objects.
|
void |
setBaseDir(File baseDir)
Sets the base directory of this reader.
|
protected WordReader(File baseDir)
protected WordReader(URL baseURL)
public void setBaseDir(File baseDir)
public File getBaseDir()
public URL getBaseURL()
public void includeWordReader(WordReader newIncludeWordReader)
newIncludeWordReader - the WordReader that will start reading words.public String nextWord(boolean isFileName, boolean expectSingleFile) throws IOException
isFileName - return a complete line (or argument), if the word
isn't an option (it doesn't start with '-').expectSingleFile - if true, the remaining line is expected to be a
single file name (excluding path separator),
otherwise multiple files might be specified
using the path separator.IOExceptionpublic String lastComments() throws IOException
null if there weren't any.IOExceptionpublic String locationDescription()
protected abstract String nextLine() throws IOException
IOExceptionprotected abstract String lineLocationDescription()
public void close()
throws IOException
IOExceptionCopyright © 2019. All rights reserved.