Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package StreamsFilesAndDirectories4;
- import java.io.*;
- public class CopyBytes {
- public static void main(String[] args) throws IOException {
- String pathIn = "input.txt";
- String pathOut = "output.txt";
- FileInputStream in = new FileInputStream(pathIn);
- FileOutputStream out = new FileOutputStream(pathOut);
- int oneByte = in.read();
- while (oneByte >= 0) {
- if (oneByte == 32 || oneByte == 10) {
- out.write((char) oneByte);
- } else {
- String digits = String.valueOf(oneByte);
- for (int index = 0; index < digits.length(); index++) {
- out.write(digits.charAt(index));
- }
- }
- oneByte = in.read();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement