Java file operations Daquan 4: read the paper

  Abstract: Java file operations Daquan 4: read the paper 

  </ Td> </ tr> <tr> <td height="35" valign="top" class="ArticleTeitle"> <% @ page contentType = "text / html; gb2312 charset ="%> 
  <% @ Page import = "java.io. *"%> 

<head>

  </ Head> 
<body>
<%
  String path = request.getRealPath ( "/ article/article5a/example/filetest"); / / Get the current directory path 
  FileReader fr = new FileReader (path + "ReadData.txt ");// establish FileReader object, and examples into fr 
  BufferedReader br = new BufferedReader (fr); / / build BufferedReader object, and examples into br 
  String Line = br.readLine ();// his string read from the document 
  / / Reader to judge whether the string is empty 
  While (Line! = Null) ( 
  Out.println (Line + " 
  ");// Read from the paper output data 
  Line = br.readLine ();// continue to read from the document in his data 
  ) 
  Br.close ();// closed BufferedReader target 
  Fr.close ();// closing documents 
%>
  </ Body> 

  <table Width="730" border="0"> <tr> <td width="724"> </ td> </ tr> </ table> </ td> </ tr> <tr> 

  ↑ Back 

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Facebook
  • DotNetKicks
  • DZone
  • Netvouz
  • Propeller

Tags:

Releated Java Articles

Comments

Leave a Reply