public class LineParser
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
LineParser.Fault
This exception is used to report problems while using a line parser.
|
Constructor and Description |
---|
LineParser(java.io.File file)
Create a line parser, reading the data in a given file.
|
LineParser(java.io.Reader in)
Create a line parser, reading data from an anonymous stream.
|
Modifier and Type | Method and Description |
---|---|
java.io.File |
getFile()
Get the file being read, or null if it is not available.
|
int |
getLineNumber()
Get the current line number within the stream being read.
|
java.lang.String[] |
readLine()
Read the next line of words from the input stream.
|
public LineParser(java.io.File file) throws java.io.FileNotFoundException, java.io.IOException
file
- the file to be readjava.io.FileNotFoundException
- if the file was not foundjava.io.IOException
- if there is some problem opening the file
or reading the initial characters of the filepublic LineParser(java.io.Reader in)
in
- the stream from which to read the datapublic java.io.File getFile()
public int getLineNumber()
public java.lang.String[] readLine() throws LineParser.Fault
LineParser.Fault
- if there is a problem reading the required data --
such as an unterminated stringCopyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.