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:org.grouplens.grapht.annotation.AnnotationProxy.java

/**
 * Customized {@code readObject} implementation to ensure the cached type is resolved.
 *
 * @param in The stream./*from  w w  w  . j av  a  2 s. co  m*/
 * @throws java.io.ObjectStreamException If there is an error reading the object from the stream.
 */
@SuppressWarnings("unchecked")
private void readObject(ObjectInputStream in) throws ObjectStreamException {
    try {
        in.defaultReadObject();
        cachedType = (Class<T>) annotationType.resolve();
    } catch (IOException e) {
        ObjectStreamException ex = new StreamCorruptedException("IO exception");
        ex.initCause(e);
        throw ex;
    } catch (ClassNotFoundException e) {
        ObjectStreamException ex = new InvalidObjectException("IO exception");
        ex.initCause(e);
        throw ex;
    }
}

From source file:org.pentaho.reporting.libraries.designtime.swing.SerializedObjectContainer.java

private void readObject(final ObjectInputStream stream) throws IOException, ClassNotFoundException {
    stream.defaultReadObject();
    final Class arrayType = (Class) stream.readObject();
    final int count = stream.readInt();
    data = (Object[]) Array.newInstance(arrayType, count);
    for (int i = 0; i < count; i++) {
        final int index = stream.readInt();
        if (index != -1) {
            data[i] = stream.readObject();
        }/*from  w ww.  ja v  a 2 s. com*/
    }
}

From source file:org.mule.transport.DefaultReplyToHandler.java

private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
    in.defaultReadObject();
    serializedData = new HashMap<String, Object>();

    serializedData.put("connectorName", in.readObject());
    serializedData.put("connectorType", in.readObject());
}

From source file:org.springframework.aop.support.IntroductionInfoSupport.java

/**
 * This method is implemented only to restore the logger.
 * We don't make the logger static as that would mean that subclasses
 * would use this class's log category./*  www .ja v  a  2s .c  o m*/
 */
private void readObject(ObjectInputStream ois) throws IOException {
    // Rely on default serialization, just initialize state after deserialization.
    try {
        ois.defaultReadObject();
    } catch (ClassNotFoundException ex) {
        throw new AspectException("Failed to deserialize Spring DelegatingIntroductionInterceptor: "
                + "Check that Spring AOP libraries and implementation class for the introduction are "
                + "available on the client side. " + ex);
    }
    // Initialize transient fields.
    this.logger = LogFactory.getLog(getClass());
}

From source file:com.phoenixst.plexus.examples.Path.java

private void readObject(ObjectInputStream in) throws ClassNotFoundException, IOException {
    in.defaultReadObject();
    if (getNodeSize() < 2) {
        throw new InvalidObjectException("A Path must have at least 2 nodes: " + getNodeSize());
    }/*  w  w  w .j  a v a 2 s.  c  o m*/
}

From source file:dk.netarkivet.common.utils.batch.LoadableFileBatchJob.java

/** Override of the default way to unserialize an object of this class.
 *
 * @param in Stream that the object can be read from.
 * @throws IOException If there is an error reading from the stream, or
 * the serialized object cannot be deserialized due to errors in the
 * serialized form.//  w  ww .  j  av a  2s .c  o  m
 * @throws ClassNotFoundException If the class definition of the
 * serialized object cannot be found.
 */
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
    in.defaultReadObject();
    log = LogFactory.getLog(this.getClass().getName());
}

From source file:net.sf.jasperreports.charts.base.JRBasePie3DPlot.java

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

    if (PSEUDO_SERIAL_VERSION_UID < JRConstants.PSEUDO_SERIAL_VERSION_UID_3_1_3) {
        depthFactorDouble = new Double(depthFactor);
        circular = Boolean.valueOf(isCircular);
    }//from   w  w  w.  j  a v  a  2s  .  c o  m
}

From source file:com.dataartisans.flink.dataflow.translation.functions.FlinkDoFnFunction.java

private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
    in.defaultReadObject();
    ObjectMapper mapper = new ObjectMapper();
    options = mapper.readValue(in, PipelineOptions.class);
}

From source file:org.pentaho.reporting.engine.classic.core.function.PaintComponentFunction.java

/**
 * Helper method for serialization.//from   w  w w .ja  v a2  s  .c om
 *
 * @param in
 *          the input stream from where to read the serialized object.
 * @throws IOException
 *           when reading the stream fails.
 * @throws ClassNotFoundException
 *           if a class definition for a serialized object could not be found.
 */
private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
    in.defaultReadObject();
    if (PaintComponentFunction.isHeadless() == false) {
        peerSupply = new Frame();
        peerSupply.setLayout(new BorderLayout());
    }
}

From source file:com.phoenixst.plexus.examples.CompleteGraph.java

private void readObject(ObjectInputStream in) throws ClassNotFoundException, IOException {
    in.defaultReadObject();
    if (getNodeSize() < 1) {
        throw new InvalidObjectException("A Complete Graph must have at least 1 node: " + getNodeSize());
    }/*from w w  w  .  j a va2 s.c  om*/
}