Advertisement
Guest User

Untitled

a guest
Feb 27th, 2012
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. try{
  2. FileInputStream fstream = new FileInputStream(filename);
  3. // Get the object of DataInputStream
  4. DataInputStream in = new DataInputStream(fstream);
  5. BufferedReader br = new BufferedReader(new InputStreamReader(in));
  6.  
  7. DataOutputStream ut = new DataOutputStream(new FileOutputStream(f));
  8. String strLine;
  9. //Read File Line By Line
  10. while ((strLine = br.readLine()) != null) {
  11. // Print the content on the console
  12.  
  13. ut.writeUTF(strLine+"\n");
  14.  
  15. }
  16. //Close the input stream
  17. in.close();
  18. }catch (Exception e){//Catch exception if any
  19. System.err.println("Error: " + e.getMessage());
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement