|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectMVFieldReader
An object which can read a text file containing information about movies,
making each field available in turn.
The fields on the file are strings, and are separated by a delimiter.
The exact meaning of the fields is unknown to this class.
See the description of CSE142 Assignment 4, Spring 2004 to know
the order that fields should be in on the text file.
For this assignment, you do NOT read the text file directly,
although you must download and copy it to your computer along with
certain .class files. The way you get movie data is by using this
MVFieldReader class.
After the last field expected of each line is read, the file automatically
advances to the next line.
The field values returned for strings could be empty, but will not be
null. All fields are trimmed of any leading and trailing spaces.
The delimiter is never returned as part of any field.
An error will occur if data beyond the end of file is requested.
Results are unspecified if any line of the file doesn't contain
at least the expected number of fields.
Field Summary | |
static int |
MOVIE_FIELD_COUNT
Expected number of fields on each line of a movie text file. |
static java.lang.String |
MOVIE_FILE_DELIMITER
Expected delimiter separating fields on the underlying text file. |
Constructor Summary | |
MVFieldReader(java.lang.String filename)
Locate and open a CSE142 movie file. |
Method Summary | |
java.lang.String |
getNextField()
Get the next field from the file. |
boolean |
hasMore()
Tells if the file has more data. |
boolean |
isAtEnd()
Tell if the file is at end. |
java.lang.String |
toString()
Tells some information about this MVFieldReader object; the format and contents of this information should not be relied on. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final java.lang.String MOVIE_FILE_DELIMITER
public static final int MOVIE_FIELD_COUNT
Constructor Detail |
public MVFieldReader(java.lang.String filename)
filename
- a string identifying the file; this can be a full URL
(local or remote); a full path on the local system; or a partial
path (such as a simple filename). The file is searched for on the
classpath first; ordinarily, if you are given a movie text file,
you should put it in the same directory where the .class file is for
MoveFile142. The lines of the text file must have fields in a certain
expected order (CSE142 Assignment 4). In case the file cannot be located,
there may be some informative messages on the console.
Blank (empty) lines are ignored.Method Detail |
public boolean isAtEnd()
public boolean hasMore()
public java.lang.String getNextField()
public java.lang.String toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |