Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void decompressFile(Scanner console, LinkedList<String> client){
- /** Counts number of bytes in the compressed file */
- int compressed = 0;
- /** Counts number of bytes in the uncompressed file */
- int uncompressed = 0;
- String nextWord = "";
- char nextChar = console.next().charAt(0);
- while(nextChar != 0){
- if(Character.isLetter(nextChar)){
- nextWord += nextChar;
- } else {
- if(!nextWord.equals("")){
- if(Character.isDigit(nextChar)){
- nextWord += nextChar;
- int index = Integer.parseInt(nextWord);
- // Look up the word in the list and move it up the list
- nextWord = client.lookAtItemN(index);
- System.out.print(nextWord);
- client.remove(index);
- client.addToFront(nextWord);
- nextWord = "";
- } else {
- System.out.print(nextWord);
- client.addToFront(nextWord);
- nextWord = "";
- }
- }
- System.out.print(nextChar);
- }
- nextChar = console.next().charAt(0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement