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:de.laures.cewolf.jfree.ThermometerPlot.java

/**
 * Provides serialization support./* ww  w  . j  a v a2 s . c  o m*/
 *
 * @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();
    this.thermometerStroke = SerialUtilities.readStroke(stream);
    this.thermometerPaint = SerialUtilities.readPaint(stream);
    this.valuePaint = SerialUtilities.readPaint(stream);
    this.mercuryPaint = SerialUtilities.readPaint(stream);
    this.subrangeIndicatorStroke = SerialUtilities.readStroke(stream);
    this.rangeIndicatorStroke = SerialUtilities.readStroke(stream);
    this.subrangePaint = new Paint[3];
    for (int i = 0; i < 3; i++) {
        this.subrangePaint[i] = SerialUtilities.readPaint(stream);
    }
    if (this.rangeAxis != null) {
        this.rangeAxis.addChangeListener(this);
    }
}

From source file:org.betaconceptframework.astroboa.model.impl.ComplexCmsPropertyImpl.java

private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {

    //Deserialize bean normally
    ois.defaultReadObject();

    //Inject lazyLoader
    LazyLoader lazyLoader = getLazyLoader();

    if (lazyLoader != null) {

        //In case this is an instance of ComplexCmsRootProperty
        //its definition will be injected when readObject of this class runs
        //right after the end of this method
        if (!(this instanceof ComplexCmsRootProperty)) {
            lazyLoader.activateClientContextForAuthenticationToken(authenticationToken);
            setPropertyDefinition((D) lazyLoader.getDefinitionService().getCmsDefinition(
                    fullPropertyDefinitionPath, ResourceRepresentationType.DEFINITION_INSTANCE, false));
        }/*from  ww  w .  j  a  va 2  s .c  o  m*/
    }
}

From source file:org.mule.DefaultMuleMessage.java

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

    boolean payloadWasSerialized = in.readBoolean();
    if (payloadWasSerialized) {
        payload = in.readObject();/*from   w w  w . j a va  2  s . c  om*/
    } else {
        int payloadSize = in.readInt();
        byte[] serializedPayload = new byte[payloadSize];
        in.read(serializedPayload);
        payload = serializedPayload;
    }
    inboundAttachments = deserializeAttachments((Map<String, SerializedDataHandler>) in.readObject());
    outboundAttachments = deserializeAttachments((Map<String, SerializedDataHandler>) in.readObject());
}

From source file:ConcurrentReferenceHashMap.java

/**
 * Reconstitute the <tt>ConcurrentReferenceHashMap</tt> instance from a
 * stream (i.e., deserialize it)./* w w  w .  j a  v  a2s.  c om*/
 * @param s the stream
 */
@SuppressWarnings("unchecked")
private void readObject(java.io.ObjectInputStream s) throws IOException, ClassNotFoundException {
    s.defaultReadObject();

    // Initialize each segment to be minimally sized, and let grow.
    for (int i = 0; i < segments.length; ++i) {
        segments[i].setTable(new HashEntry[1]);
    }

    // Read the keys and values, and put the mappings in the table
    for (;;) {
        K key = (K) s.readObject();
        V value = (V) s.readObject();
        if (key == null)
            break;
        put(key, value);
    }
}

From source file:edu.cmu.tetrad.bayes.MlBayesIm.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//from   w ww  .java  2s .  c o m
 * @throws ClassNotFoundException
 */
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException {
    s.defaultReadObject();

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

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

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

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

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

From source file:org.hibernate.internal.SessionFactoryImpl.java

/**
 * Custom serialization hook defined by Java spec. Used when the factory is
 * directly deserialized/*  w w  w  .  j a  va 2  s . c om*/
 * 
 * @param in
 *            The stream from which the object is being deserialized.
 * 
 * @throws IOException
 *             Can be thrown by the stream
 * @throws ClassNotFoundException
 *             Again, can be thrown by the stream
 */
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
    LOG.trace("Deserializing");
    in.defaultReadObject();
    LOG.debugf("Deserialized: %s", uuid);
}

From source file:edu.umd.cs.marmoset.modelClasses.TestOutcome.java

private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
    int thisMinorVersion = stream.readInt();
    if (thisMinorVersion != serialMinorVersion)
        throw new IOException("Illegal minor version " + thisMinorVersion + ", expecting minor version "
                + serialMinorVersion);//from   ww  w.  jav  a2  s.com
    stream.defaultReadObject();
    truncateLongTestResult();
}

From source file:com.ikanow.aleph2.analytics.services.AnalyticsContext.java

/** Serialization constructor
 * @param ois//from   w w w.ja va2 s  .  c  o  m
 * @throws ClassNotFoundException
 * @throws IOException
 * @throws SecurityException 
 * @throws NoSuchFieldException 
 * @throws IllegalAccessException 
 * @throws IllegalArgumentException 
 */
private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException, NoSuchFieldException,
        SecurityException, IllegalArgumentException, IllegalAccessException {
    // default deserialization
    ois.defaultReadObject();

    // fill in the final fields
    {
        final Field f = this.getClass().getDeclaredField("_mutable_state");
        f.setAccessible(true);
        f.set(this, new MutableState());
    }
    {
        final Field f = this.getClass().getDeclaredField("_mapper");
        f.setAccessible(true);
        f.set(this, BeanTemplateUtils.configureMapper(Optional.empty()));
    }
    {
        final Field f = this.getClass().getDeclaredField("_multi_writer");
        f.setAccessible(true);
        f.set(this, new SetOnce<MultiDataService>());
    }
    {
        final Field f = this.getClass().getDeclaredField("_state_name");
        f.setAccessible(true);
        f.set(this, State.IN_MODULE);
    }

    // fill in the object fields
    initializeNewContext(_mutable_serializable_signature);
}

From source file:je3.rmi.MudClient.java

 /**
  * This method is used for custom de-serialization.  Since the vectors of
  * people and of their names are transient, they are not serialized with
  * the rest of this place.  Therefore, when the place is de-serialized,
  * those vectors have to be recreated (empty).
  **//*from   www.j a v  a2s.c  o  m*/
 private void readObject(ObjectInputStream in) 
throws IOException, ClassNotFoundException {
     in.defaultReadObject();  // Read most of the object as normal
     names = new Vector();    // Then recreate the names vector
     people = new Vector();   // and recreate the people vector
 }

From source file:com.cyberway.issue.crawler.framework.CrawlController.java

private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
    stream.defaultReadObject();
    // Setup status listeners
    this.registeredCrawlStatusListeners = Collections.synchronizedList(new ArrayList<CrawlStatusListener>());
    // Ensure no holdover singleThreadMode
    singleThreadMode = false;//from w w w  . ja  v  a2  s .  c  om
}