Vector

A

andrewzzz

Hi guys,
I have to use a Vector object to store a growable array of objects,but
I have an implementative question :
I have to create the Vector only the first time the class cointaining
it will be extecuted , then I have to add elements ,
without deleting old entries , and creating new instances of the
class :
Here is my actual simple code , that I think will delete all my
entries every time the class is executed.
Another question : after deserializing a class , I need to
instanciate it?
Thanks a lot guys!!! bytebye
(please note that I'm obliged to use Vector..)


public class AgentMessage implements Serializable{
private static final long serialVersionUID = 1L;
transient private StaticPart sp;//per metodo get
transient private DynElement de;

private Vector dynvector;



public AgentMessage(String agent,byte[] code,String
mainclass,Certificate signerId,PrivateKey priv,String
configuration,Serializable dclear,byte[] dsecret,PathEl[] dpath,byte[]
c){


sp=new
StaticPart(agent,code,mainclass,signerId,priv,configuration);
de=new DynElement(dclear,dsecret,c,dpath);//deve diventare vector


dynvector=new Vector();/
dynvector.add(de);

}


}
 
A

Andrew Thompson

I have to use a Vector object to store a growable array of objects,but
I have an implementative question :
I have to create the Vector only the first time the class cointaining
it will be extecuted , then I have to add elements ,
without deleting old entries , and creating new instances of the
class :
Here is my actual simple code , that I think will delete all my
entries every time the class is executed.
Another question :

No. Actually you have made a number of
statements, but asked no question, up to
this point.
...after deserializing a class , I need to
instanciate it?

No. Serialized data comes back as *objects*
of the classes that were serialized. If you
had to instantiate the class, and repopulate
the attributes, it would make the process of
serialisation/deserialisation pointless.
Thanks a lot guys!!! bytebye
(please note that I'm obliged to use Vector..)

Please note that a student doing their thesis,
is usually supposed to have enough clarity of
thought to know when they are asking a question,
and some of that clarity of thought might be well
put to thinking of better thread titles than
'Vector' and 'Sinature'. Perhaps
'Vector use and serialisation' &
'Sign code with public key'?

Andrew T.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,430
Messages
2,571,676
Members
48,796
Latest member
Greg L.

Latest Threads

Top