![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Newbie
Join Date: Mar 2008
Posts: 2
Rep Power: 0
![]() |
decoding compressed BLOBS
I'm working on a program that accesses an Interbase 5.x database using firebird/jaybird and the jdbc libraries. I've run into a problem with some compressed BLOB fields though.
I'm able to stream the BLOB into a text file, but have had no luck with decompressing the data. Every attempt I've made to send the BLOB's InputStream through a FilteredStream (such as InflatorInputStream or ZipInputStream) has failed. Does anyone have any experience with compressing/decompressing BLOB fields with java? Where am I going wrong? Thanks,
//Get the blob (in Test_Data column) and store it in the Java BLOB object.
//Get an inputStream from the BLOB object so we can read it.
Blob importantData = testResults.getBlob("Test_Data");
InputStream blobStream = importantData.getBinaryStream();
//Create our output file
File myFile = new File("BlobOut.txt");
FileOutputStream fout = new FileOutputStream(myFile,true);
// Create a ZipInputStream from the InputStream
ZipInputStream unZipBlob = new ZipInputStream(blobStream);
//Read from the BLOB's inputStream until it's empty.
while(unZipBlob.available() > 0)
//while(blobStream.available() > 0)
{
//write decompressed data to the output file
fout.write(unZipBlob.read());
//Write the raw compressed binary data. Appears to work fine, but isn't readable!
//fout.write(blobStream.read());
}
//Close the file output stream.
fout.close();
} |
|
|
|
|
|
#2 |
|
Newbie
Join Date: Mar 2008
Posts: 2
Rep Power: 0
![]() |
Re: decoding compressed BLOBS
Update: The BLOBs were compressed using the PKZIP 2.0 Deflate algorithm (Abbrevia's DeflateStream)
I'm having no luck setting up an InflaterInputStream though. It returns a zero or a 1 then dies. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Storing BLOBs in a database - problem | jonyzz | Other Programming Languages | 8 | Jan 31st, 2007 4:38 AM |
| JPEG decoding | qash | C++ | 3 | Aug 30th, 2005 9:50 AM |