sreek, Thiru

Greenhorn
+ Follow
since Feb 21, 2001
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by sreek, Thiru

hello Chip here is the solution for ur problem..
the "objectstreamwalker" in this package seems to be more like what u want
http://staff.develop.com/halloway/code/objectio.html

Enjoy
-- sreek
20 years ago

Is there any mechanism in java, which enables us to browse into a serialized file and deserialize a specific object???
I some how stored the offsets of diff objects in the serialized file. but when i try to skip through the ObjectInputStream while deserializing it gives me stream corrupted Exception I tried to use skipBytes(), read(),readBytes()... all of them give me
StreamCorrupted Exception: reached EOF in stream... Any info in this aspect would be of great help.
Thanks
Sreek
20 years ago
My application needs me to serialize some objects... but when deserializing instead of deserializing the entire file,i should be able to index into the serialized object file and deserialize a specific object. I thught of creating an index with object sizes.
sreek
20 years ago
i may not be able to give u a solid answer but... as far as i know when ever a thread looses its control it frees all the locks held by it.so i guess it depends on ur exception handling
--sreek
thanks for ur help....
i don't think i can implement ur suggestions in my application... it would have been better if we had an easy way to do it.
anyway... thanks a lot
regards
Sreek
[This message has been edited by sreek, Thiru (edited February 22, 2001).]
20 years ago
Java uses Hex code to write into serialized file... if u have any hex-file editor u can view it... or the usual way is to deserialize the objects in the file and perform get() methods (must be in the class def) to printout the info u want.
hope this would be helpful to u.
regards,
sreek
20 years ago
hi, I want to know if there is any mechanism in java which gives the byte size of a arbitrary object....
something similar to sizeof() in C(!!!)
sreek
20 years ago
Yes , it seems that only because the thread might not have been started yet.. the result is so....
if we introduce sleep of even 1 ms u will get 10.(i ran it so)
i ran it with sleep(0)... it gave me 5.. I wonder what would a thread do for sleep(0)???
sreek
I am trying to read a file and skip some bytes ... using "skipBytes" method, but it always skips zero bytes irrespective of what the argument is....
here is the code.
long fp...(from some other method)
fos = new FileInputStream("emp.ser");
bos = new BufferedInputStream(fos);
oos = new ObjectInputStream(fos);
try{
int avail = oos.available();
System.out.println("avail = " + avail);
int b = oos.skipBytes( (int)fp);
if(b != (int)fp )
System.out.println("b =" + b + " & fp = " + fp);
}
catch( Exception e) { e.printStackTrace(); }

output is :
avail = 0
b=0 & fp = given val
I am striving with this from past 10 to 12 hrs ... someone please help me.
20 years ago
Hello, I am serializing few objects and writing them to a file using "writeObject" method... I want to know if there is any mechanism in Java that allows you to index into this file while deserializing it... ie .. can I somehow index into this file read a specific object?
20 years ago