18 package org.turro.plugin;
20 import java.io.ByteArrayInputStream;
21 import java.io.ByteArrayOutputStream;
22 import java.io.IOException;
23 import java.io.ObjectInputStream;
24 import java.io.ObjectOutputStream;
25 import java.io.Serializable;
26 import java.util.logging.Level;
27 import java.util.logging.Logger;
33 public class GenericObject
implements Serializable {
35 private Serializable object;
47 object = (Serializable)
new ObjectInputStream(
new ByteArrayInputStream(buf)).readObject();
48 }
catch (IOException e) {
49 Logger.getLogger(
GenericObject.class.getName()).log(Level.SEVERE,
null, e);
50 }
catch (ClassNotFoundException ex) {
51 Logger.getLogger(
GenericObject.class.getName()).log(Level.SEVERE,
null, ex);
57 ByteArrayOutputStream baos =
new ByteArrayOutputStream();
58 ObjectOutputStream oos =
new ObjectOutputStream(baos);
59 oos.writeObject(
object);
61 return baos.toByteArray();
62 }
catch (IOException e) {
63 Logger.getLogger(
GenericObject.class.getName()).log(Level.SEVERE,
null, e);
void setObject(Serializable object)
void bytesToObject(byte[] buf)