标签:
1 FileInputStream in = null; 2 3 try { 4 in = new FileInputStream("myfile.txt"); 5 int b; 6 b = in.read(); 7 while (b != -1) { 8 System.out.print((char) b); 9 b = in.read(); 10 } 11 } catch (IOException e) { 12 System.out.println(e.getMessage()); 13 14 } catch (FileNotFoundException e) { 15 e.printStackTrace(); 16 17 } finally { 18 try { 19 in.close(); 20 } catch (IOException e) { 21 e.printStackTrace(); 22 } 23 }
标签:
原文地址:http://www.cnblogs.com/roger-h/p/4457197.html