本文整理匯總了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);
}