This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes JDBC and the fly likes length of input stream Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "length of input stream" Watch "length of input stream" New topic
Author

length of input stream

Madhuri Abhi
Greenhorn

Joined: Jun 29, 2011
Posts: 11
How can i know the length of an input stream?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 16487
    
    2

Generally, you can't. That's because an InputStream might eventually return data which doesn't even exist at the time you ask that question.

But why is this a JDBC question?
Madhuri Abhi
Greenhorn

Joined: Jun 29, 2011
Posts: 11
I am sorry that i have posted this question in a wrong group. this is a simple java question.

I have an image in database which is actually in the form of hexa decimal. I am getting it as binary stream and converting it to bye array and finally into an iamge. I would like to calculate the size of the image.

Since i use Derby database, I cant use

Please help
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 26496
    
  78

THis is a database question since it deals with reading an image from the database. You are on the right place. Storing an image in hex is a problem. It should be stored in binary/BLOB format.

When you call rs.getBlob(), there is a method to get the length. Not sure if this would work with CLOB or if it corrupts the file.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: length of input stream
 
Similar Threads
java/input-output stream
Is ProgressMonitorInputStream broken?
getting the value of .properties file
IllegalBlockSizeException while decrypting using Triple DES
Size of an InputStream