Example usage for java.io ObjectInputStream defaultReadObject

List of usage examples for java.io ObjectInputStream defaultReadObject

Introduction

In this page you can find the example usage for java.io ObjectInputStream defaultReadObject.

Prototype

public void defaultReadObject() throws IOException, ClassNotFoundException 

Source Link

Document

Read the non-static and non-transient fields of the current class from this stream.

Usage

From source file:com.projity.pm.task.NormalTask.java

private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException {
    s.defaultReadObject();

    hasKey = HasKeyImpl.deserialize(s, this);
    customFields = CustomFieldsImpl.deserialize(s);
    if (version < 1)
        currentSchedule = TaskSchedule.deserialize(s);
    else {/*from w  w w  . j av a 2s  .  co m*/
        snapshots = new SnapshottableImpl(Settings.numBaselines());
        int sCount = s.readInt();
        for (int i = 0; i < sCount; i++) {
            int snapshotId = s.readInt();
            TaskSnapshot snapshot = TaskSnapshot.deserialize(s, this);
            setSnapshot(new Integer(snapshotId), snapshot);
        }
    }

    if (version < 1)
        super.initializeTransientTaskObjects();
    else
        super.initializeTransientTaskObjectsAfterDeserialization();
    //       barClosureInstance = new BarClosure();
    //       This shouldn't be called -hk 4/feb/05
    //       initializeDates();

    version = DEFAULT_VERSION;
}

From source file:org.rdv.viz.chart.ChartPanel.java

/**
 * Provides serialization support.//from   w  w  w. java 2 s  .  c  om
 *
 * @param stream  the input stream.
 *
 * @throws IOException  if there is an I/O error.
 * @throws ClassNotFoundException  if there is a classpath problem.
 */
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
    stream.defaultReadObject();

    // we create a new but empty chartMouseListeners list
    this.chartMouseListeners = new EventListenerList();

    // register as a listener with sub-components...
    if (this.chart != null) {
        this.chart.addChangeListener(this);
    }

}

From source file:com.rockhoppertech.music.midi.js.MIDITrack.java

/**
 * Serializaiton method.// w  w w  . j  av  a2  s  . c om
 * 
 * @param in
 *            the input stream
 * @throws IOException
 *             if something went wrong
 * @throws ClassNotFoundException
 *             if the class is not found
 */
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
    // our "pseudo-constructor"
    in.defaultReadObject();
    // now we are a "live" object again
    this.changes = new PropertyChangeSupport(this);
    this.midiStringParser = new MIDIStringParser();
}

From source file:com.projity.pm.assignment.Assignment.java

private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException {
    s.defaultReadObject();
    hasKey = HasKeyImpl.deserialize(s, this);
    //       barClosureInstance = new BarClosure();
}

From source file:org.plasma.sdo.core.CoreDataObject.java

/**
 * Reads in metadata logical names as string
 * during de-serialization looks up and/*from  ww  w . j  av  a  2 s .  com*/
 * restores references.
 * @param in
 * @throws IOException
 * @throws ClassNotFoundException
 */
private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
    in.defaultReadObject();
    this.type = PlasmaTypeHelper.INSTANCE.getType(this.typeUri, this.typeName);
    this.typeName = null;
    this.typeUri = null;
    if (this.containmentPropertyName != null) {
        Type propertyType = PlasmaTypeHelper.INSTANCE.getType(this.containmentPropertyTypeUri,
                this.containmentPropertyTypeName);
        this.containmentProperty = propertyType.getProperty(this.containmentPropertyName);
        this.containmentPropertyName = null;
        this.containmentPropertyTypeName = null;
        this.containmentPropertyTypeUri = null;
    }
}

From source file:com.projity.pm.task.Project.java

private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException {
    s.defaultReadObject();
    hasKey = HasKeyImpl.deserialize(s, this);
    //initUndo();
    tasks = new LinkedList();
    objectEventManager = new ObjectEventManager();
    objectSelectionEventManager = new ObjectSelectionEventManager();
    scheduleEventManager = new ScheduleEventManager();
    multipleTransactionManager = new MultipleTransactionManager();
    projectListenerList = new EventListenerList();
    taskOutlines = new OutlineCollectionImpl(Settings.numHierarchies(), this);
    barClosureInstance = new BarClosure();

}

From source file:edu.cmu.tetrad.sem.SemIm.java

/**
 * Adds semantic checks to the default deserialization method. This method
 * must have the standard signature for a readObject method, and the body of
 * the method must begin with "s.defaultReadObject();". Other than that, any
 * semantic checks can be specified and do not need to stay the same from
 * version to version. A readObject method of this form may be added to any
 * class, even if Tetrad sessions were previously saved out using a version
 * of the class that didn't include it. (That's what the
 * "s.defaultReadObject();" is for. See J. Bloch, Effective Java, for help.
 *
 * @throws java.io.IOException//w w  w .j a v  a  2  s  .  c o m
 * @throws ClassNotFoundException
 */
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException {
    s.defaultReadObject();

    if (semPm == null) {
        throw new NullPointerException();
    }

    if (variableNodes == null) {
        throw new NullPointerException();
    }

    if (measuredNodes == null) {
        throw new NullPointerException();
    }

    // Translate old data formats into new.
    if (edgeCoefC != null) {
        edgeCoef = new TetradMatrix(edgeCoefC.toArray());
        edgeCoefC = null;
    }

    if (errCovarC != null) {
        errCovar = new TetradMatrix(errCovarC.toArray());
        errCovar = null;
    }

    if (sampleCovarC != null) {
        sampleCovar = new TetradMatrix(sampleCovarC.toArray());
        sampleCovar = null;
    }

    if (implCovarC != null) {
        implCovar = new TetradMatrix(implCovarC.toArray());
        implCovar = null;
    }

    if (implCovarMeasC != null) {
        implCovarMeas = new TetradMatrix(implCovarMeasC.toArray());
        implCovarMeas = null;
    }

    if (variableMeans == null) {
        throw new NullPointerException();
    }

    if (freeParameters == null) {
        throw new NullPointerException();
    }

    if (freeMappings == null) {
        throw new NullPointerException();
    }

    if (fixedParameters == null) {
        throw new NullPointerException();
    }

    if (fixedMappings == null) {
        throw new NullPointerException();
    }

    if (meanParameters == null) {
        meanParameters = initMeanParameters();
    }

    if (sampleSize < 0) {
        throw new IllegalArgumentException("Sample size out of range: " + sampleSize);
    }

    if (getInitializationParams() == null) {
        setInitializationParams(new SemImInitializationParams());
    }

    if (distributions == null) {
        distributions = new HashMap<Node, Distribution>();
    }
}

From source file:com.phoenixst.plexus.DefaultGraph.java

/**
 *  Deserialize this <code>DefaultGraph</code>.
 *
 *  @serialData the number of nodes (int), all the nodes, the
 *  number of edges (int), all the edges.
 *//*w ww .java  2  s.c o m*/
private void readObject(ObjectInputStream in) throws ClassNotFoundException, IOException {
    in.defaultReadObject();
    observableDelegate = new ObservableGraphDelegate(this, EVENT_LOGGER);

    int nodeSize = in.readInt();
    if (nodeSize < 0) {
        throw new InvalidObjectException("Node size is less than 0: " + nodeSize);
    }
    nodeMap = new HashMap(nodeSize);
    if (LOGGER.isInfoEnabled()) {
        LOGGER.info("Deserializing " + instanceString);
    }

    for (int i = 0; i < nodeSize; i++) {
        Object node = in.readObject();
        if (nodeMap.containsKey(node)) {
            throw new InvalidObjectException("Duplicate node: " + node);
        }
        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("  " + instanceString + " deserialization: Adding node " + node);
        }
        nodeMap.put(node, new AdjacencyList(node));
    }

    edgeSize = in.readInt();
    if (edgeSize < 0) {
        throw new InvalidObjectException("Edge size is less than 0: " + edgeSize);
    }
    for (int i = 0; i < edgeSize; i++) {
        Graph.Edge edge = (Graph.Edge) in.readObject();

        AdjacencyList tailAdj = (AdjacencyList) nodeMap.get(edge.getTail());
        if (tailAdj == null) {
            throw new InvalidObjectException("Graph.Edge tail is not a node: " + edge.getTail());
        }
        if (tailAdj.contains(edge)) {
            throw new InvalidObjectException("Duplicate edge: " + edge);
        }
        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("  " + instanceString + " deserialization: Adding edge " + edge);
        }
        tailAdj.edges.add(edge);

        if (!GraphUtils.equals(edge.getTail(), edge.getHead())) {
            AdjacencyList headAdj = (AdjacencyList) nodeMap.get(edge.getHead());
            if (headAdj == null) {
                throw new InvalidObjectException("Graph.Edge head is not a node: " + edge.getHead());
            }
            headAdj.edges.add(edge);
        }
    }
}

From source file:org.apache.openjpa.kernel.StateManagerImpl.java

private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
    _broker = (BrokerImpl) in.readObject();
    in.defaultReadObject();

    // we need to store the class before the pc instance so that we can
    // create _meta before calling readPC(), which relies on _meta being
    // non-null when reconstituting ReflectingPC instances. Sadly, this
    // penalizes the serialization footprint of non-ReflectingPC SMs also.
    Class managedType = (Class) in.readObject();
    _meta = _broker.getConfiguration().getMetaDataRepositoryInstance().getMetaData(managedType, null, true);

    _pc = readPC(in);//from  ww  w  . java2s . c om
}

From source file:org.apache.clerezza.utils.Uri.java

/**
 * Read a URI.// www .  ja  v a 2 s  .c om
 *
 * @param ois the object-input stream
 * @throws ClassNotFoundException If one of the classes specified in the
 * input stream cannot be found.
 * @throws IOException If an IO problem occurs.
 */
private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {

    ois.defaultReadObject();
}