impossible to serialize object in xml launch configs in 3.1 RC3 [message #287262] |
Tue, 28 June 2005 10:49 |
Eclipse User |
|
|
|
Hi, there
I need to serialize an object in a launch XML configuration.
I tried to use the ILaunchConfigurationWorkingCopy.setAttribute(String,
String) but it does not seem to work I cannot manage to deserialize my
classes.
Please tell me how can I do this?
SeB.
the code I use to serialize my object
------------------------------------------------------------ --
public void storesSignalingInstanceTo(ILaunchConfigurationWorkingCopy
configuration) throws IOException {
ByteArrayOutputStream bos = new ByteArrayOutputStream(1000);
try {
getSignalingType().serializeSignalingInstance(bos);
bos.flush();
configuration.setAttribute(MhdkSignalingTab.ATTR_SIGNALING_S ERIALIZED_INSTANCE,
bos.toString());
}catch (Exception e) {
//wrap all exceptions in a IOException
IOException ioe = new IOException("could not serialize signaling
instance"); //$NON-NLS-1$
ioe.initCause(e);
throw ioe;
}
}
the code I use to deserialize my object
------------------------------------------------------------ --
public Signaling restoreSignalingInstanceFrom(ILaunchConfiguration
configuration) throws CoreException, IOException{
String serializedInst =
configuration.getAttribute(MhdkSignalingTab.ATTR_SIGNALING_S ERIALIZED_INSTANCE,
(String) null);
InputStream is = new ByteArrayInputStream(serializedInst.getBytes());
//$NON-NLS-1$
try {
return getSignalingType().deserializeSignalingInstance(is);
} catch (Exception e) {
IOException ioe = new IOException("could not deserialize signaling
instance"); //$NON-NLS-1$
ioe.initCause(e);
throw ioe;
}
}
|
|
|
Powered by
FUDForum. Page generated in 0.03194 seconds