-
Notifications
You must be signed in to change notification settings - Fork 0
/
readfile.rtf
74 lines (68 loc) · 2.18 KB
/
readfile.rtf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
{\rtf1\ansi\ansicpg1252\cocoartf2513
\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fswiss\fcharset0 Helvetica-Bold;\f1\fswiss\fcharset0 Helvetica;\f2\fswiss\fcharset0 Helvetica-BoldOblique;
}
{\colortbl;\red255\green255\blue255;\red127\green0\blue85;\red0\green0\blue192;\red42\green0\blue255;
\red106\green62\blue62;\red63\green127\blue95;\red127\green159\blue191;}
{\*\expandedcolortbl;;\csgenericrgb\c49804\c0\c33333;\csgenericrgb\c0\c0\c75294;\csgenericrgb\c16471\c0\c100000;
\csgenericrgb\c41569\c24314\c24314;\csgenericrgb\c24706\c49804\c37255;\csgenericrgb\c49804\c62353\c74902;}
\margl1440\margr1440\vieww10800\viewh8400\viewkind0
\deftab720
\pard\pardeftab720\partightenfactor0
\f0\b\fs24 \cf2 public
\f1\b0 \cf0
\f0\b \cf2 void
\f1\b0 \cf0 readFile() \{\
\
\f0\b \cf2 try
\f1\b0 \cf0 \{\
\
System.
\f2\i\b \cf3 out
\f1\i0\b0 \cf0 .println(\cf4 "inside"\cf0 );\
\ul br\ulnone =
\f0\b \cf2 new
\f1\b0 \cf0 BufferedReader(
\f0\b \cf2 new
\f1\b0 \cf0 InputStreamReader(
\f0\b \cf2 new
\f1\b0 \cf0 FileInputStream(\ul file\ulnone )));\
\f0\b \cf2 if
\f1\b0 \cf0 (\ul br\ulnone .readLine().trim().isEmpty()) \{\
endFile();\
\f0\b \cf2 return
\f1\b0 \cf0 ;\
\
\}
\f0\b \cf2 else
\f1\b0 \cf0 \{\
beginFile(\cf3 filename\cf0 );\
String \cf5 record\cf0 ;\
\f0\b \cf2 while
\f1\b0 \cf0 ((\cf5 record\cf0 = \ul br\ulnone .readLine().trim()) !=
\f0\b \cf2 null
\f1\b0 \cf0 ) \{\
parseRecord(\cf5 record\cf0 );\
\}\
endFile();\
\}\
\cf6 //Error catching if file name is not correct\cf0 \
\}
\f0\b \cf2 catch
\f1\b0 \cf0 (Exception \cf5 ioe\cf0 ) \{\
\cf5 ioe\cf0 .printStackTrace();\
\}
\f0\b \cf2 finally
\f1\b0 \cf0 \{\
\f0\b \cf2 try
\f1\b0 \cf0 \{\
\ul br\ulnone .close();\
\}
\f0\b \cf2 catch
\f1\b0 \cf0 (IOException \cf5 e\cf0 ) \{\
\cf6 //
\f0\b \cf7 TODO
\f1\b0 \cf6 Auto-generated catch block\cf0 \
\cf5 e\cf0 .printStackTrace();\
\}\
\}\
\}}