Board index » delphi » How i can I write file in bit or write run length code in file

How i can I write file in bit or write run length code in file

How can i write code to file in bit order or runlength code
Eg 001 + 01001 + 010011000 + 011101
how to write it in to file
 

Re:How i can I write file in bit or write run length code in file


Quote
Kiat Inthuwannarat wrote in message ...
>How can i write code to file in bit order or runlength code
>Eg 001 + 01001 + 010011000 + 011101
>how to write it in to file

Bit streams?

Groetjes,
Maarten Wiltink

Re:How i can I write file in bit or write run length code in file


I don't know what they call. but it must merge variable length code to
hex and write onn file  0010000+00001 = 0010 0000 0001 = 201 H
Quote

> Bit streams?

> Groetjes,
> Maarten Wiltink

Re:How i can I write file in bit or write run length code in file


You could certainly create a TBitStream class that would allow this kind
of writing ... if I kinda sound distracted it must be because I'm
writing it in my head while writing this -- as many of you are probably
doing yourself while reading this.

[I envision the constructor of such an object taking a stream as one of
its parameters.]

Basically, your "position" in a bit-stream would be calculated in terms
of bits not bytes, and what this means is simply that the rightmost
three bits of the position ("position and $07") represent a bit-shift
and the remaining 29 bits ("position shr 3") represent the location of
the starting byte in question.

Then, when reading and writing bytes, you're doing a lot of bit-shifting
and ANDing with a mask and ORing the new values into place.  It depends
on how fancy and generic you need the routines to be.

PKZIP and other compress/enciphering routines commonly use such
algorithms because a PKZIP-compressed file is in fact a bitstream not a
bytestream.  You might be able to "lift" the routines from there.

Quote
>Kiat Inthuwannarat wrote:

> I don't know what they call. but it must merge variable length code to
> hex and write onn file  0010000+00001 = 0010 0000 0001 = 201 H

> > Bit streams?

----------------------------------------------------------------
Sundial Services :: Scottsdale, AZ (USA) :: (480) 946-8259
mailto:i...@sundialservices.com  (PGP public key available.)
Quote
> Fast(!), automatic table-repair with two clicks of the mouse!
> ChimneySweep(R):  Release 4.0 is here!!
> http://www.sundialservices.com/products/chimneysweep

Other Threads