aspose file tools*
The moose likes I/O and Streams and the fly likes Problem with RandomAccessFile Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Problem with RandomAccessFile" Watch "Problem with RandomAccessFile" New topic
Author

Problem with RandomAccessFile

Andreas Groscurth
Greenhorn

Joined: Mar 08, 2004
Posts: 12
Hi,

can anyone tell my why I do get -1393754107 with this code instead of 1

Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Because an ObjectOutputStream writes a header, too. Take a look at the size of the file that's been written - it's bigger than just the 4 bytes that writeInt() would give you. You really don't want to read this with anything other than an ObjectInputStream. Or in this case, if you're not going to use writeObject() and readObject() at some point, there's really no need to be using the ObjectOutput streams at all.


"I'm not back." - Bill Harding, Twister
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with RandomAccessFile
 
Similar Threads
NX (UrlyBird):Accessing the config.txt file inside the runme.jar
Serializable
how to getcursor to first location of file?
Question on RandomAccessFile
NX: db-2x1?