File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes ObjectOutputStream?? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "ObjectOutputStream??" Watch "ObjectOutputStream??" New topic
Author

ObjectOutputStream??

ali rafiq
Ranch Hand

Joined: Jan 09, 2003
Posts: 75
i wanna ask u that . i have work on it .. let assum that i have make a file
ObjectOutoutStream oos = new ObjectOutoutStream(new FileOutoutStream(file.tes));
that file.tes save an one object like that
String str = {"Mohummad","Ali","Rafiq",...};
now do we save in that file more than two object???


if u learn to break the rock .. next day u will be looking to Mountain.
John Lee
Ranch Hand

Joined: Aug 05, 2001
Posts: 2545
Yes, you can. It is just a 'write' process. You can write as much as you can.
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18652
I'm not sure what was being asked:
"Can we save more than one object using ObjectOutputStream?"
Yes, as Don said - you can keep calling writeObject()as many times as you want, for as many different files as you want, as long as you don't run out of memory or file space.
"Can multiple objects be stored as the result of a single writeObject() call?"
Yes. In this example

the single writeObject() invocation actually stores one String[] array and three String objects. A later a single readObject() will read all four into JVM memory.
[ February 09, 2003: Message edited by: Jim Yingst ]

"I'm not back." - Bill Harding, Twister
 
 
subject: ObjectOutputStream??
 
Threads others viewed
Save contents of text area to file
Writing objects to files and reading them back into the UI
Open a file on the fly
JAXP Problem!!
how to add to a application path??
IntelliJ Java IDE