Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #
- public static void run() throws Exception{
- #
- #
- StringBuffer fileContents = new StringBuffer();
- #
- #
- FileInputStream fi = new FileInputStream(new File("text.in"));
- #
- #
- int line = 0;
- #
- #
- while ((line = fi.read()) != -1)
- #
- fileContents.append(line).append("\n");
- #
- #
- processFile(fileContents.toString());
- #
- String s = compress(fileContents.toString());
- #
- #
- BufferedOutputStream bw = new BufferedOutputStream(new FileOutputStream(new File("compressed.out")));
- #
- //System.out.println(s);
- #
- String tmp;
- #
- for (int j = 0; j < s.length(); j+=8)
- #
- {
- #
- #
- if (j + 8 < s.length()-8)
- #
- tmp = s.substring(j, j + 8);
- #
- else
- #
- tmp = s.substring(j, s.length() - 1);
- #
- #
- int x= Integer.parseInt(tmp,2);
- #
- System.out.println(x);
- #
- bw.write(x);
- #
- }
- #
- #
- bw.close();
- #
- #
- System.out.println("finish");
- #
- #
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement