Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import chn.util.*;
- public class Squeeze
- {
- public Squeeze(FileInput inFile, FileOutput outFile)
- {
- String line;
- String inLine = "";
- int indents = 0;
- while(inFile.hasMoreLines())
- {
- line = inFile.readLine();
- for (int i = 0; i < line.length(); i++)
- {
- if (line.charAt(i) == '\t')
- indents ++;
- else inLine += line.charAt(i);
- }
- System.out.println(indents + " " + inLine);
- outFile.println(indents + " " + inLine);
- inLine = "";
- indents = 0;
- }
- outFile.close();
- }
- public static void main(String[] args)
- {
- FileInput inFile = new FileInput("F:\\APCS\\Unit 5\\before.txt");
- FileOutput outFile = new FileOutput("F:\\APCS\\Unit 5\\after.txt");
- Squeeze compressed = new Squeeze(inFile, outFile);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment