public class ReadFile {
public static void main(String args[]){
String pathRequest = "SupportFiles\\Test\\"+apiName+".txt";
readFile(pathRequest);
}
private static void readFile(String pathRequest) {
FileInputStream fis = null;
DataInputStream in = null;
InputStreamReader isr = null;
BufferedReader br = null;
try {
fis = new FileInputStream(pathRequest);
in = new DataInputStream(fis);
isr = new InputStreamReader(in);
br = new BufferedReader(isr);
String strLine;
while ((strLine = br.readLine()) != null){
System.out.println (strLine);
}
} catch (Exception e) {
e.printStackTrace();
}finally{
try {
br.close();
isr.close();
in.close();
fis.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
No comments:
Post a Comment