Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Mar 26th, 2008, 1:58 AM   #1
ggilmour
Newbie
 
Join Date: Mar 2008
Posts: 2
Rep Power: 0 ggilmour is on a distinguished road
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();
}
ggilmour is offline   Reply With Quote
Old Mar 26th, 2008, 1:23 PM   #2
ggilmour
Newbie
 
Join Date: Mar 2008
Posts: 2
Rep Power: 0 ggilmour is on a distinguished road
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.
ggilmour is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Storing BLOBs in a database - problem jonyzz Other Programming Languages 8 Jan 31st, 2007 5:38 AM
JPEG decoding qash C++ 3 Aug 30th, 2005 10:50 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 8:11 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC