lzop file header structure / reading the uncompressed file size from from the lzo compressed header

551 views Asked by At

I am writing an android application using java in which I need to decompress random lzo compressed files in byte arrays. I am doing that with the https://github.com/shevek/lzo-java library. The algorithm, however expects the size of the original file (uncompressed file) in order to decompress the lzo file.

byte[] uncompressed = new byte["Size of the uncompressed byte array which should be known before decompression"];
ByteArrayInputStream is = new ByteArrayInputStream("compressed byte array");
LzopInputStream us = new LzopInputStream(is);
DataInputStream ds = new DataInputStream(us);
System.out.println(ds.readByte());
ds.readFully(uncompressed);    

I need to read the uncompressed file size from the header of the lzop compressed file. Where can I find the header structure of such files or read the decompressed file size from the header of an lzop compressed file?

(For the header, I read the first few hundred bytes, but reading them either in BIG_ENDIAN or LITTLE_ENDIAN or as shorts, Ints, and Longs -and with different beginnings for the bytes do not verify the uncompressed file size for a known file)

Thank you in advance for your help!

0

There are 0 answers