Re-Write of the File Reader

Assignment #3
Due: 2/11/2002
Points: 10

Re-write the file reader program from Assignment #2 to accept a socket in the constructor.  The program should implement Runnable. In the "run" method, it should read a line from the socket.  The first character in the line will be converted to a char, the rest will be converted to a long.

If the char passed in is 'R', then read from the text file until a line starting with the long is found.  Pass that line back through the socket.

If the char passed in is 'L', then create a comma-separated string of your item id and item name properties from each line in the text file.  Pass that string back through the socket.

Do this as follows:

Suppose you have

BufferedReader reader = new BufferedReader(new InputStreamReader(client.getInputStream()));

Then, do:

String input = reader.readLine();
char command = input.charAt(0);
long id = Long.parseLong(input.substring(1));

switch (command) {

case 'L':

case 'R':

}