Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Vector serialization

Posted on 2001-07-27
4
1,644 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 Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

839 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