hi.
i'm in the process of implementing the LZW compression.
we hav to used fix length encoding, starting from 10 upto 32 bits per code.
i think i'm right in understanding this:
bufferedwriter, write(), only writes a byte at at time.
now i have to pad my first 256 compressions codes (simply the ascii values) with two 00 to make them the minimum of a 10 bit
pattern.
now how do i go about doing this.
i've got a long at the moment (64bit eh?), and i'm shifting it to the left << 54, pushing it up againts the left, i need to do this because other codes coming in use this long as a buffer, then i write the first 8 bits, pushing it again to the left << 8 and continue to write.
i just can't figure out how to get the MSB out of the long into a byte in order to write to a file.
if you don't get this tell me what you don't get and i'll try explain it a little better.. any help apprecitaed.
if there is a better javaranch forum this topic should be in, please tell me.
cheers