Pointer to 500 points! q: About an encoder

Link to the 1st thread:
http://www.experts-exchange.com/Programming/Languages/Java/Q_23122949.html

Instructions:
"write a program that compresses les so that they are
as small as possible and decompress to exactly the original le. How the compression program works is
completely up to you. Note that all numbers are written in hexidecimal notation as it makes bit patterns
easier to see. "

specs:

The decompressor is quite simple, it has a dictionary of 0xFF (that is, 255) phrases. The zeroth phrase is a byte with value 0x0, the first phrase is a byte with value 0x1 and so on, (the nth element of the array is a
phrase consisting of a bytse with value n). The decompressor reads the input one byte at a time and treats
each one as an instruction:
0xFF Set N equal to the next byte of the input and output N (called an escape action)
0xFE Set N equal to the next byte of the input and output the Nth phrase in the dictionary (called a look
up action)
0xFD Do nothing
...
0xF0 Do nothing
0xEF Repeat the next instruction 0xF (that is 15) times
0xEE Repeat the next instruction 0xE (that is 14) times
...
0xE2 Repeat the next instruction 2 times
0xE1 Repeat the next instruction 1 time (these are called repeat actions)
0xE0 Do nothing
0xDF Set N equal to the next byte of the input and set the Nth phrase in the dictionary equal to the next
0xF instructions 0xDE - Set N equal to the next byte of the input and set the Nth phrase in the
dictionary equal to the next 0xE instructions
...
0xD2 Set N equal to the next byte of the input and set the Nth phrase in the dictionary equal to the next
0x2 instructions
0xD1 Set N equal to the next byte of the input and set the Nth phrase in the dictionary equal to the next
instruction (these are called define actions)
0xD0 Do nothing
0xCF Output the 0xCFth phrase in the dictionary
0xCE Output the 0xCFth phrase in the dictionary
...
0x02 Output the 0x2nd (second) phrase in the dictionary
0x01 Output the 0x1nd (first) phrase in the dictionary
0x00 Output the 0x0th (zeroth) phrase in the dictionary
perdoname_Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

sciuriwareCommented:
I wonder why you should bother with writing a compressor.
Why not compress from byte array to byte array via the ZIP methods.
Refer to the java.util.zip.ZipOutputStream class.

;JOOP!
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.