Solved

Vector serialization

Posted on 2001-07-27
4
1,631 Views
Last Modified: 2010-05-18
Is it possible to serialize a vector, and if so how?

thanks in advance...
ck
0
Comment
Question by:captainklink
4 Comments
 
LVL 1

Accepted Solution

by:
Recall earned 50 total points
ID: 6326267
Yes it is.  Vector implements the Serializable interface, so you can simply create a FileOutputStream and write your object to it ...

See here for more info

http://developer.java.sun.com/developer/technicalArticles/Programming/serialization/

Recall
0
 
LVL 1

Expert Comment

by:googlyralph
ID: 6326272
yes, its just an object, and as such you can call a write method on it.

//Vector writing class

Vector myVector = new Vector();
try{
ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream("theVEctorFile"));
out.writeObject(myVector);
out.close();
}catch(Exception e){
System.out......
}

Googly Ralph.
0
 
LVL 92

Expert Comment

by:objects
ID: 6326338
Just make sure all the elements in the Vector are serializable.
0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 8975297
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:


-- points to Recall


Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
sudhakar_koundinya
EE Cleanup Volunteer
---------------------
If you feel that your question was not properly addressed, or that none of the comments received were appropriate answers, please post your concern in THIS thread.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now