1/**
2 * Copyright(C) 1999
3 * All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc..
4 *
5 * Permission to use, copy, modify, and distribute this
6 * software and its documentation for EDUCATIONAL purposes
7 * and without fee is hereby granted provided that this
8 * copyright notice appears in all copies.
9 *
10 * @date : July 1, 1999.
11 * @authorĀ : Salih Yurttas.
12 */
13
14
15import java.io.*;
16
17public class PhoneBookFileIO {
18
19 public int namePhoneFileInput(String filename,
20 String[] name,
21 String[] phone)
22 throws IOException
23 {
24 FileInputStream fIS = new FileInputStream(filename);
25 InputStreamReader fISR = new InputStreamReader(fIS);
26 BufferedReader bR = new BufferedReader(fISR);
27
28 String t;
29 int count = 0;
30 while(bR.ready()) {
31 String s = new String(bR.readLine());
32 t = new String(s.substring(0,16));
33 name[count] = t.trim();
34 t = new String(s.substring(17));
35 phone[count] = t.trim();
36 ++count;
37 }
38 bR.close();
39
40 return count;
41 }
42
43}