Guest User

Untitled

a guest
Oct 23rd, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. import java.io.FileReader;
  2.  
  3. public static void copyCharacters() throws IOException {
  4. FileReader inputStream = null;
  5. FileWriter outputStream = null;
  6.  
  7. try {
  8. inputStream = new FileReader("Motown.txt");
  9. outputStream = new FileWriter("Motown_output.txt");
  10.  
  11. int c;
  12. while ((c = inputStream.read()) != -1) {
  13. outputStream.write(c);
  14. }
  15. } finally {
  16. if (inputStream != null) {
  17. inputStream.close();
  18. }
  19. if (outputStream != null) {
  20. outputStream.close();
  21. }
  22. }
  23. }
  24. public static void main(String[] args) {
  25. // TODO Auto-generated method stub
  26. try {
  27. copyCharacters();
  28. } catch (IOException e) {
  29. // TODO Auto-generated catch block
  30. e.printStackTrace();
  31. }
  32.  
  33. }
Add Comment
Please, Sign In to add comment