use of org.eclipse.ecf.sync.SerializationException in project ecf by eclipse.
the class Message method serialize.
public byte[] serialize() throws SerializationException {
try {
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
final ObjectOutputStream oos = new ObjectOutputStream(bos);
oos.writeObject(this);
return bos.toByteArray();
} catch (final Exception e) {
throw new SerializationException(Messages.DocShare_EXCEPTION_DESERIALIZING_MESSAGE0, e);
}
}
use of org.eclipse.ecf.sync.SerializationException in project ecf by eclipse.
the class Message method deserialize.
/**
* Deserialize in to message
* @param bytes
* @return IModelChangeMessage
* @throws SerializationException
*/
public static IModelChangeMessage deserialize(byte[] bytes) throws SerializationException {
try {
final ByteArrayInputStream bins = new ByteArrayInputStream(bytes);
final ObjectInputStream oins = new ObjectInputStream(bins);
return (IModelChangeMessage) oins.readObject();
} catch (final Exception e) {
throw new SerializationException(Messages.DocShare_EXCEPTION_DESERIALIZING_MESSAGE0, e);
}
}
use of org.eclipse.ecf.sync.SerializationException in project ecf by eclipse.
the class SharedDocClient method processRemoteMessage.
private void processRemoteMessage(byte[] msg) {
if (msg != null) {
try {
synchronized (this.getClass()) {
IModelChange change = syncStrategy.deserializeRemoteChange(msg);
System.out.println(name + ";received=" + change);
IDocumentChange[] documentChanges = (IDocumentChange[]) syncStrategy.transformRemoteChange(change);
for (int i = 0; i < documentChanges.length; i++) {
applyChangeToLocalDocument(false, documentChanges[i]);
}
}
} catch (SerializationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
use of org.eclipse.ecf.sync.SerializationException in project ecf by eclipse.
the class Message method serialize.
static byte[] serialize(Object object) throws SerializationException {
try {
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
final ObjectOutputStream oos = new ObjectOutputStream(bos);
oos.writeObject(object);
return bos.toByteArray();
} catch (IOException e) {
throw new SerializationException(e);
}
}
Aggregations