本文整理汇总了Java中weka.core.scripting.JythonSerializableObject类的典型用法代码示例。如果您正苦于以下问题:Java JythonSerializableObject类的具体用法?Java JythonSerializableObject怎么用?Java JythonSerializableObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JythonSerializableObject类属于weka.core.scripting包,在下文中一共展示了JythonSerializableObject类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SerializedObject
import weka.core.scripting.JythonSerializableObject; //导入依赖的package包/类
/**
* 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);
}