Puff.c How do I create the defalte stream that will work - gzip

I'm using Zlib to deflate a series of arrays using compress. My test code uses uncompress and works correctly. Here's my question:
Can I use Zlib compress my array so that it can be uncompressed using puff.c. Puff.c is available in a much larger application and I do not have the option of installing Zlib as a library.
I ran pufftest.c with zero.raw successfully, but How do I create zeros.raw

"raw" means no zlib header or trailer. You can simply strip the two-byte header and four-byte trailer from the output of compress to feed to puff. Better would be to process the zlib header and trailer (documented in RFC 1950), and feed the deflate innards to puff. Then the trailer provides an integrity check on the uncompressed data, as was intended.

Related

What is the `level` argument in zlib Deflate?

I am trying to parse a PDF in C and I am using the zlib library for deflating. In the documentation, the zlibInit function takes an argument which is labeled as level. What is the purpose of that argument and how can I obtain it from the PDF stream?
If there is a level argument, then you are using the wrong function to aid in parsing a PDF. level is only used for compression. For the PDF you need decompression. Compression in zlib is called "deflate". Decompression in zlib is called "inflate". You want to inflate, not deflate.

How to extract the encoding dictionary from gzip archives

I am looking for a method whereby I can extract the encoding dictionary made by DEFLATE algorithm from a gzip archive.
I need the LZ77 made pointers from the whole archive which refer to patterns from the file as well as the Huffman tree with the aforementioned pointers.
Is there any solution in python?
Does anyone know the https://github.com/madler/infgen/blob/master/infgen.c which might provide the dictionary?
The "dictionary" used for compression at any point in the input is nothing more than the 32K bytes of uncompressed data that precede that point.
Yes, infgen will disassemble a deflate stream, showing all of the LZ77 references and the derived Huffman codes in a readable form. You could run infgen from Python and interpret the output in Python.
infgen also has a -b option for a non-human-readable binary format that might be faster to process for what you want to do.

Does BigQuery support avro compression or not?

On one documentation here: https://cloud.google.com/bigquery/docs/loading-data-cloud-storage-avro#avro_compression it clearly says avro compression is not supported.
On another documentation here: https://cloud.google.com/bigquery/docs/loading-data#loading_compressed_and_uncompressed_data it says Avro format is preferred for compressed data.
Can someone tell me what this means? I am really confused.
The documentation in both places only talks about compressed data blocks, which is supported, and they are consistent.
Compressed data blocks means that the data inside the Avro files is compressed. You cannot stick an Avro file inside a zip or gzip container. It's like how PNGs have compression but a gzipped image is not the same thing.

How to match ZLib stream between VBA 6/VBA 7and Java 8?

We are being able to do the following.
In VBA 6/ VBA 7:
Refer a 32 bit zlibwapi.dll (VBA 6) or 64 bit zlibwapi.dll (VBA 7).
Invoke compress() or compress2() methods to generate compressed
streams
Invoke uncompress() and uncompress2() methods to decompress
compressed streams
In Java 8 (JDK 1.8 on Tomcat 8)
Have a simple java program that compresses data using the new
Deflater() instance
Have a simple Java program that decompresses using Inflater()
instance
We are failing when VBA sends out the compressed stream for Java Servlet to uncompress or when Java Servlet sends out compressed response data for VBA to decompress.
We are aware of following facts.
there are 3 formats provided by ZLib (raw, zlib and gzip).
The methods in zlibwapi.dll namely compress() and compress2()
generates compressed bytes in zlib format. This has been mentioned
in a similar thread at
Java decompressing array of bytes
Inflater() instance on Java side allows to uncompress zlib format
data as per a code sample posted at
Compression / Decompression of Strings using the deflater
Java 8 has zlib version 1.2.5 integrated as part of java.utils.zip
package.
We have ensured that we are using zlibwapi.dll version
1.2.5 on VBA side as well.
We have tried to use Hex editors to compare byte streams of compressed data independently generated by VBA and Java as well. We notice some difference in the generated compressed data. We think it is this difference that is causing both the environments to misunderstand each other.
Additionally, we think that when communication occurs, there has to be some common charset that governs the encoding/decoding scheme between both the endpoints. We have even tried to compare the hex code of byte stream generated by VBA and communicated across to Java Servlet.
The bytes seem to be getting some additional 0 bytes inserted in
between the actual set of compressed bytes while communication
occurs. This happens on VBA side. May be because of some unicode interpretation.
Whatever bytes get communicated across to Java appear entirely
different in their representation.
We need to fix our independently working code to communicate with one another and compress and decompress peacefully. We think there are 2 things to address - Getting format to match and using a charset that sends bytes as is. We are looking for any assistance from experts on this front that can help us find correct path to the possible solution. We need answers for
Does compress2() or compress() really generate zlib format?
Which charset will allow us to send bytes as is (if there are 10
bytes, we want to send 10 bytes. Not 20). If its unicode, 0 bytes
get inserted in between (10 bytes become 20 bytes because of this).
Yes.
Don't send characters. Send bytes.

Compressing the final output data into gzip format

I am getting the final output data in C++ as a string.....Need to compress that data in gzip format.Can someone tell me the way about how to implement it?
Use zlib. It's probably already available in your development environment. (Which for some reason you are keeping a secret in your question.)