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.sakaiproject.tool.assessment.facade.ItemFacade.java

/**
 * implements Serializable method//ww w.j  av  a  2s. c  o m
 * @param in
 * @throws IOException
 * @throws java.lang.ClassNotFoundException
 */
private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
    in.defaultReadObject();
}

From source file:net.di2e.ecdr.commons.CDRMetacard.java

/**
 * Deserializes this instance./*from ww  w. ja  v  a  2  s .com*/
 * 
 * @param stream
 *            the {@link ObjectInputStream} that contains the bytes of the object
 * @throws IOException
 * @throws ClassNotFoundException
 */
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {

    /*
     * defaultReadObject() is invoked for greater flexibility and compatibility. See the *Serialization Note* in
     * class Javadoc.
     */
    stream.defaultReadObject();

    map = new HashMap<String, Attribute>();

    wrappedMetacard = null;

    type = (MetacardType) stream.readObject();

    if (type == null) {
        throw new InvalidObjectException(MetacardType.class.getName() + " instance cannot be null.");
    }

    int numElements = stream.readInt();

    for (int i = 0; i < numElements; i++) {

        Attribute attribute = (Attribute) stream.readObject();

        if (attribute != null) {

            AttributeDescriptor attributeDescriptor = getMetacardType()
                    .getAttributeDescriptor(attribute.getName());

            if (attributeDescriptor != null && attribute.getValue() != null) {
                attributeDescriptor.getType().getAttributeFormat();
                attributeDescriptor.getType().getClass();
            }

        }

        setAttribute(attribute);
    }

}

From source file:org.limewire.mojito.routing.impl.RouteTableImpl.java

private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
    in.defaultReadObject();
    listeners = new CopyOnWriteArrayList<RouteTableListener>();

    // Post-Init the Buckets
    for (Bucket bucket : bucketTrie.values()) {
        ((BucketNode) bucket).postInit();
    }/*  www.  j  a va  2 s.c  o m*/
}

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

/**
 * A helper method that deserializes a object from the given stream.
 *
 * @param stream// ww  w.  j a  va2s .  co  m
 *          the stream from which to read the object data.
 * @throws IOException
 *           if an IO error occured.
 * @throws ClassNotFoundException
 *           if an referenced class cannot be found.
 */
private void readObject(final ObjectInputStream stream) throws IOException, ClassNotFoundException {
    stream.defaultReadObject();
    this.attributes = new ReportAttributeMap<Object>(stream.readLong());
    final String[] nameSpaces = (String[]) stream.readObject();
    for (int i = 0; i < nameSpaces.length; i++) {
        final String nameSpace = nameSpaces[i];
        final String[] names = (String[]) stream.readObject();
        for (int j = 0; j < names.length; j++) {
            final String name = names[j];
            final int nullHandler = stream.readByte();
            if (nullHandler == 0) {
                final Object attribute = SerializerHelper.getInstance().readObject(stream);
                this.attributes.setAttribute(nameSpace, name, attribute);
            }
        }
    }
}

From source file:com.projity.pm.resource.ResourceImpl.java

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

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

}

From source file:org.jgap.gp.impl.GPConfiguration.java

/**
 * When deserializing, do specific initializations.
 *
 * @param a_inputStream the ObjectInputStream provided for deserialzation
 *
 * @throws IOException//from www . j  a v a 2 s . c  o m
 * @throws ClassNotFoundException
 *
 * @author Klaus Meffert
 * @since 3.2
 */
private void readObject(ObjectInputStream a_inputStream) throws IOException, ClassNotFoundException {
    //always perform the default de-serialization first
    a_inputStream.defaultReadObject();
    try {
        init(false);
    } catch (InvalidConfigurationException iex) {
        iex.printStackTrace();
        throw new IOException(iex.toString());
    }
}

From source file:net.lightbody.bmp.proxy.jetty.http.HttpServer.java

private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
    in.defaultReadObject();
    HttpListener[] listeners = getListeners();
    HttpContext[] contexts = getContexts();
    _listeners.clear();/*w  w w  . jav a2s .  c o m*/
    _virtualHostMap.clear();
    setContexts(contexts);
    setListeners(listeners);
    _statsLock = new Object[0];
}

From source file:com.application.utils.FastDatePrinter.java

/**
 * Create the object after serialization. This implementation reinitializes the
 * transient properties.// w w w. j  av a 2 s  . c  om
 *
 * @param in ObjectInputStream from which the object is being deserialized.
 * @throws IOException            if there is an IO issue.
 * @throws ClassNotFoundException if a class cannot be found.
 */
private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
    in.defaultReadObject();
    init();
}

From source file:org.everit.jira.timetracker.plugin.JiraTimetrackerWebAction.java

/**
 * The readObject method for the transient variable.
 *
 * @param in/*from   w ww  . ja v a  2s  .c  o  m*/
 *          The ObjectInputStream.
 * @throws IOException
 *           IOException.
 * @throws ClassNotFoundException
 *           ClassNotFoundException.
 */
private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
    in.defaultReadObject();
    issues = new ArrayList<Issue>();
}