Java 类weka.core.scripting.JythonSerializableObject 实例源码

项目:repo.kmeanspp.silhouette_score    文件:SerializedObject.java   
/**
 * Creates a new serialized object.
 *
 * @param toStore the object to store
 * @param compress whether or not to use compression
 * @exception Exception if the object couldn't be serialized
 */ 
public SerializedObject(Object toStore, boolean compress) throws Exception {

  ByteArrayOutputStream ostream = new ByteArrayOutputStream();
  OutputStream os = ostream;
  ObjectOutputStream p;
  if (!compress)
    p = new ObjectOutputStream(new BufferedOutputStream(os));
  else
    p = new ObjectOutputStream(new BufferedOutputStream(new GZIPOutputStream(os)));
  p.writeObject(toStore);
  p.flush();
  p.close(); // used to be ostream.close() !
  m_storedObjectArray = ostream.toByteArray();

  m_isCompressed = compress;
  m_isJython     = (toStore instanceof JythonSerializableObject);
}
项目:autoweka    文件:SerializedObject.java   
/**
 * Creates a new serialized object.
 *
 * @param toStore the object to store
 * @param compress whether or not to use compression
 * @exception Exception if the object couldn't be serialized
 */ 
public SerializedObject(Object toStore, boolean compress) throws Exception {

  ByteArrayOutputStream ostream = new ByteArrayOutputStream();
  OutputStream os = ostream;
  ObjectOutputStream p;
  if (!compress)
    p = new ObjectOutputStream(new BufferedOutputStream(os));
  else
    p = new ObjectOutputStream(new BufferedOutputStream(new GZIPOutputStream(os)));
  p.writeObject(toStore);
  p.flush();
  p.close(); // used to be ostream.close() !
  m_storedObjectArray = ostream.toByteArray();

  m_isCompressed = compress;
  m_isJython     = (toStore instanceof JythonSerializableObject);
}
项目:umple    文件:SerializedObject.java   
/**
 * Creates a new serialized object.
 *
 * @param toStore the object to store
 * @param compress whether or not to use compression
 * @exception Exception if the object couldn't be serialized
 */ 
public SerializedObject(Object toStore, boolean compress) throws Exception {

  ByteArrayOutputStream ostream = new ByteArrayOutputStream();
  OutputStream os = ostream;
  ObjectOutputStream p;
  if (!compress)
    p = new ObjectOutputStream(new BufferedOutputStream(os));
  else
    p = new ObjectOutputStream(new BufferedOutputStream(new GZIPOutputStream(os)));
  p.writeObject(toStore);
  p.flush();
  p.close(); // used to be ostream.close() !
  m_storedObjectArray = ostream.toByteArray();

  m_isCompressed = compress;
  m_isJython     = (toStore instanceof JythonSerializableObject);
}