• Post Reply Bookmark Topic Watch Topic
  • New Topic

StreamCorruptedException

 
Asif Masood
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am gettting "java.io.StreamCorruptedException: invalid stream header" exception while trying to read a binay object from MS SQL Server database. I successfully stored this object (this is an object of a text file) earlier.

Here is the code;

ObjectInputStream ois=new ObjectInputStream(rs.getBinaryStream(4));
Object encodedReturn =ois.readObject();

rs.getBinaryStream() returns an invalid stream header.

Please help me in finding out the reason of this exception. Any suggestion or piece of code will surely help me in resolving this issue.

Thanks
Asif Masood
 
Joe Ess
Bartender
Posts: 9362
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do you store the object? Sounds like you aren't using an ObjectOutputStream if the header is invalid.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!