This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

length of input stream

 
Madhuri Abhi
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can i know the length of an input stream?
 
Paul Clapham
Sheriff
Pie
Posts: 20758
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
author & internet detective
Marshal
Posts: 34095
337
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic