Java file operations Daquan 6: Skip bytes do not read

  Abstract: Java file operations Daquan 6: Skip bytes do not read 

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

<head>

  </ Head> 
<body>
<%
  String path = request.getRealPath ( "/ article/article5a/example/filetest"); 
  FileReader fr = new FileReader (new File (path, "ReadData.txt "));// establish FileReader object, and examples into fr 
  Out.println ( "the current directory:" + path + " 
");
  Fr.skip (2); / / Skip two bytes 
  Out.println ( "read out the contents of the documents:" + " 
");
  Int c = 1 byte read fr.read ();// 
  While (c! =- 1) ( 
  Out.print ((char) c); 
  C = fr.read (); 
  ) 
  Fr.close (); 

%>
  </ Body> 


  Attachment: ReadData.txt: 

ASFFFAF
  3234242 </ 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