UserParser

UserParser - } /* Parse all lines from the database. * *...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
import java.io.*; import java.util.Scanner; /* Parse the user database. * * The format of this database is one user per line, with user fields separated * by a ",". The format is: * * username,surname,givenname * * Note that there is no space before or after the ",". */ public class UserParser { private User[] m_users; /* The main function. * * It should be provided exactly one argument -- the filename of the * database to open and parse. */ public static void main(String[] argv) throws FileNotFoundException, ParseError { FileReader fr = new FileReader("IMDBTop10-users.txt"); UserParser up = new UserParser(fr); User[] users = up.getUsers(); // Do something with "users" here.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: } /* Parse all lines from the database. * * @param fr The FileReader object from which to read the database. */ public UserParser(FileReader fr) throws ParseError { } /* Return a copy of the array of users */ public User getUsers() throws ParseError { } /* Parse all lines from the database. * * @param scn The Scanner object from which to read the database. */ private void parseAll(Scanner scn) throws ParseError { } /* Parse one line from the database. * * @param line One line from the user database, without the newline * character. */ private User parseOne(String line) throws ParseError { } }...
View Full Document

This note was uploaded on 11/11/2011 for the course CS 2110 taught by Professor Francis during the Spring '07 term at Cornell.

Page1 / 2

UserParser - } /* Parse all lines from the database. * *...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online