Alex Co
2009-06-25 15:00:32 UTC
Hi all,
Jini serialization is not the same as writeObject/readObject serialization, right?
Suppose I have a compiled class file called MyServiceRegistrarProxy that
implements ServiceRegistrar, Serializable.
MyServiceRegistrarProxy x= new MyServiceRegistrarProxy();
Now I want to store the x object into a file but following the same serialization
protocol that reggie follows when it returns its serviceregistrar to clients by
sockets.
I want that the file contents be compliant with the future use of:
ServiceRegistrar registrar = lookup.getRegistrar();
e.g on future i want to have a second thread or something reading the file and
sending file data to clients and clients building ServiceRegistrar objects from
my MyServiceRegistrarProxy type.
To serialize the object to file using standard serialization i do this:
String filename = "myserviceregistrar.svr";
FileOutputStream fos = null;
ObjectOutputStream out = null;
MyServiceRegistrarProxy p = new MyServiceRegistrarProxy();
try
{
fos = new FileOutputStream(filename);
out = new ObjectOutputStream(fos);
out.writeObject(p);
out.close();
}
catch(IOException ex)
{
ex.printStackTrace();
}
whichs classes can i use to serialize it to file in a Jini compliant way?
An example would be very appreciated.
Thanks a lot
Alex
--------------------------------------------------------------------------
Getting Started: http://www.jini.org/wiki/Category:Getting_Started
Community Web Site: http://jini.org
jini-users Archive: http://archives.java.sun.com/archives/jini-users.html
Unsubscribing: email "signoff JINI-USERS" to ***@java.sun.com
Jini serialization is not the same as writeObject/readObject serialization, right?
Suppose I have a compiled class file called MyServiceRegistrarProxy that
implements ServiceRegistrar, Serializable.
MyServiceRegistrarProxy x= new MyServiceRegistrarProxy();
Now I want to store the x object into a file but following the same serialization
protocol that reggie follows when it returns its serviceregistrar to clients by
sockets.
I want that the file contents be compliant with the future use of:
ServiceRegistrar registrar = lookup.getRegistrar();
e.g on future i want to have a second thread or something reading the file and
sending file data to clients and clients building ServiceRegistrar objects from
my MyServiceRegistrarProxy type.
To serialize the object to file using standard serialization i do this:
String filename = "myserviceregistrar.svr";
FileOutputStream fos = null;
ObjectOutputStream out = null;
MyServiceRegistrarProxy p = new MyServiceRegistrarProxy();
try
{
fos = new FileOutputStream(filename);
out = new ObjectOutputStream(fos);
out.writeObject(p);
out.close();
}
catch(IOException ex)
{
ex.printStackTrace();
}
whichs classes can i use to serialize it to file in a Jini compliant way?
An example would be very appreciated.
Thanks a lot
Alex
--------------------------------------------------------------------------
Getting Started: http://www.jini.org/wiki/Category:Getting_Started
Community Web Site: http://jini.org
jini-users Archive: http://archives.java.sun.com/archives/jini-users.html
Unsubscribing: email "signoff JINI-USERS" to ***@java.sun.com