• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Need help in DeSerialization of Objects

 
Ranch Hand
Posts: 257
Hibernate Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

While Deserializing the the Objects I want to know how many bytes have been read by the ObjectInputStream from the ByteArrayInputStream or any other Stream.

That is How many bytes have been read by the ObjectInputStream() when , the readObject() method has been called?

Please help me with this problem.
 
Srinivas Kalvala
Ranch Hand
Posts: 257
Hibernate Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is one way, I have worked out.

First read the Object from the ObjectInputStream, then pass that Object to the Seperate ObjectOutputStream.writeObject() which is Decorated over the ByteArrayOutputStream()....Now you can read the size of the ByteArrayOutputStream() to know the size of that particular Object. But this is not good as you see from a developer point of view in terms of efficiency and coding style.

Any other solution will help me a lot.....
 
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How about before you read it with method available() - Returns the number of bytes that can be read without blocking.
[ May 11, 2006: Message edited by: Carl Trusiak ]
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Carl politely closed all the duplicate copies of this thread you posted; I, being less nice, just followed behind and deleted them all. Please read this and please don't do it again.
[ May 11, 2006: Message edited by: Ernest Friedman-Hill ]
 
Srinivas Kalvala
Ranch Hand
Posts: 257
Hibernate Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ernest Friedman-Hill:
Carl politely closed all the duplicate copies of this thread you posted; I, being less nice, just followed behind and deleted them all. Please read this and please don't do it again.

[ May 11, 2006: Message edited by: Ernest Friedman-Hill ]




I am sorry. I will not repeat it again. actually I dont know.

Thank you.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic