Last active
December 28, 2015 05:20
-
-
Save golenishchev/663eaf9363e343f4d884 to your computer and use it in GitHub Desktop.
Lesson 13. FileInputStream, FileOutputStream
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.FileInputStream; | |
import java.io.FileOutputStream; | |
import java.io.IOException; | |
public class FileManager { | |
public static void main(String[] args) throws Exception { | |
FileInputStream fin = new FileInputStream("first.txt"); | |
FileOutputStream fout = new FileOutputStream("second.txt"); | |
int i = -1; | |
while((i = fin.read()) != -1) { | |
System.out.print("byte: " + (byte)i + "\tchar: " + (char)i + "\n"); | |
fout.write((byte)i); | |
} | |
fin.close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment