Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package DPM;
- import java.io.FileInputStream;
- import java.io.FileOutputStream;
- import java.io.IOException;
- public class Main {
- public static void main(String[] args) throws IOException {
- String inputPath = "D:\\Coding\\Java\\Softuni\\Java Advanced - January 2019" +
- "\\04. Java-Advanced-Fiels-and-Directories-Lab\\04. Java-Advanced-" +
- "Files-and-Streams-Lab-Resources\\input.txt";
- String outputPath = "D:\\Coding\\Java\\Softuni\\Java Advanced - January 2019" +
- "\\04. Java-Advanced-Fiels-and-Directories-Lab\\04. Java-Advanced-" +
- "Files-and-Streams-Lab-Resources\\output.txt";
- FileReader inFile = new FileReader(inputPath);
- FileWriter outFile = new FileWriter(outputPath);
- int oneByte = 0;
- while ((oneByte = inFile.read()) >= 0){
- if (oneByte == 10 || oneByte == 32){
- outFile.write(oneByte);
- }else {
- String num = String.valueOf(oneByte);
- for (int i = 0; i < num.length(); i++) {
- outFile.write(num.charAt(i));
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment