Package weka.core

# Class SerializedObject

java.lang.Object
weka.core.SerializedObject

All Implemented Interfaces:
  `Serializable`, `RevisionHandler`

public class SerializedObject extends Object implements Serializable, RevisionHandler
Class for storing an object in serialized form in memory. It can be used to make deep copies of objects, and also allows compression to conserve memory.

Version:
  $Revision: 1.12 $
Author:
  Richard Kirkby (rbk1@cs.waikato.ac.nz)
See Also:
  - Serialized Form

## Constructor Summary

Constructors
Constructor
Description
`SerializedObject(Object toStore)`
Creates a new serialized object (without compression).
`SerializedObject(Object toStore, boolean compress)`
Creates a new serialized object.

## Method Summary

Modifier and Type
Method
Description
`final boolean`
`equals(Object compareTo)`
`Object`
`getObject()`
Returns a serialized object.
`String`
`getRevision()`
Returns the revision string.
`int`
`hashCode()`
Returns a hashcode for this object.

### Methods inherited from class java.lang.Object

`getClass, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### SerializedObject

public SerializedObject(Object toStore) throws Exception
Creates a new serialized object (without compression).

Parameters:
  `toStore` - the object to store
Throws:
  `Exception` - if the object couldn't be serialized

### SerializedObject

public SerializedObject(Object toStore, boolean compress) throws Exception
Creates a new serialized object.

Parameters:
  `toStore` - the object to store
  `compress` - whether or not to use compression
Throws:
  `Exception` - if the object couldn't be serialized

## Method Details

### equals

public final boolean equals(Object compareTo)

Overrides:
  `equals` in class `Object`

### hashCode

public int hashCode()
Returns a hashcode for this object.

Overrides:
  `hashCode` in class `Object`
Returns:
  the hashcode

### getObject

public Object getObject()
Returns a serialized object. Uses org.python.util.PythonObjectInputStream for Jython objects (read here for more details).

Returns:
  the restored object
Throws:
  `Exception` - if the object couldn't be restored

### getRevision

public String getRevision()
Returns the revision string.

Specified by:
  `getRevision` in interface `RevisionHandler`
Returns:
  the revision