Compressing Byte Arrays

  • Thread starter Thread starter G.M. Harland
  • Start date Start date
G

G.M. Harland

Please keep in mind that I am a PowerBuilder developer working on his first
..NET project.

I have a VB.NET console app that is responsible for taking MS Word docs and
getting them into an Oracle 9i database using a BLOB column.

I have read in the file using a file stream and then put it in a byte array.
The problem is that I need to compress the byte array before inserting into
the database. I have tried to use ZLIB, but I cannot get the uncompression
to return anything but -5, so I have no way of knowing if the compression
was even valid to begin with.

Any advice/help/samples/etc would be greatly appreciated.

Thanks,
Glenn Harland
 
If you want to take the "easy" way out, J# can deal with Java classes and
Jar files, so it has a compression utility class. Just add a reference to
that assembly and you're good to go. Luckily J# is only Java syntax, but the
assemblies are compiled into CIL (and thus usable by any .NET language). I
think the only pissy detail you have to deal with is that streams in there
work on SBYTE instead of BYTE - this is one of my "damn Java" moments :-)

-Rob Teixeira [MVP]
 
Back
Top