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:IdentityHashMap.java

/**
 * Reconstitute the <tt>IdentityHashMap</tt> instance from a stream (i.e.,
 * deserialize it)./* w  w w  .  jav  a 2s  .c  o  m*/
 */
private void readObject(java.io.ObjectInputStream s) throws IOException, ClassNotFoundException {
    // Read in the threshold, loadfactor, and any hidden stuff
    s.defaultReadObject();

    // Read in number of buckets and allocate the bucket array;
    int numBuckets = s.readInt();
    table = new Entry[numBuckets];

    // Read in size (number of Mappings)
    int size = s.readInt();

    // Read the keys and values, and put the mappings in the IdentityHashMap
    for (int i = 0; i < size; i++) {
        Object key = s.readObject();
        Object value = s.readObject();
        put(key, value);
    }
}

From source file:org.taverna.server.master.worker.RemoteRunDelegate.java

@SuppressWarnings("unchecked")
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
    in.defaultReadObject();
    if (log == null)
        log = getLog("Taverna.Server.LocalWorker");
    final String creatorName = in.readUTF();
    SecurityContextFactory factory = (SecurityContextFactory) in.readObject();
    try {/*from   w  w w . j  a va2  s. com*/
        secContext = factory.create(this, new UsernamePrincipal(creatorName));
    } catch (RuntimeException | IOException e) {
        throw e;
    } catch (Exception e) {
        throw new SecurityContextReconstructionException(e);
    }
    run = ((MarshalledObject<RemoteSingleRun>) in.readObject()).get();
}

From source file:org.mule.DefaultMuleEvent.java

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

    try {/*from ww  w  . j a v a  2s. c  o m*/
        // Optional
        serializedData.put("serviceName", in.readObject());
    } catch (OptionalDataException e) {
        // ignore
    }
}

From source file:edu.dlnu.liuwenpeng.render.NewXYBarRenderer.java

/**    
* Provides serialization support.    /* w w  w .java  2 s.  com*/
*    
 * @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.legendBar = SerialUtilities.readShape(stream);
}

From source file:edu.dlnu.liuwenpeng.render.CandlestickRenderer.java

/**    
* Provides serialization support.    /* w  w  w  . ja v  a  2  s  .co  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.upPaint = SerialUtilities.readPaint(stream);
    this.downPaint = SerialUtilities.readPaint(stream);
    this.volumePaint = SerialUtilities.readPaint(stream);
}

From source file:com.google.bitcoin.core.Block.java

private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {
    ois.defaultReadObject();
    // This code is not actually necessary, as transient fields are initialized to the default value which is in
    // this case null. However it clears out a FindBugs warning and makes it explicit what we're doing.
    hash = null;/*from   ww w  . j av  a2  s.  co  m*/
}

From source file:org.apache.ojb.broker.util.ReferenceMap.java

/**
 *  Reads the contents of this object from the given input stream.
 *
 *  @param inp  the input stream to read from
 *  @throws java.io.IOException  if the stream raises it
 *  @throws java.lang.ClassNotFoundException  if the stream raises it
 *///  w  w w.  j  a va 2s . c o m
private void readObject(ObjectInputStream inp) throws IOException, ClassNotFoundException {
    inp.defaultReadObject();
    table = new Entry[inp.readInt()];
    threshold = (int) (table.length * loadFactor);
    queue = new ReferenceQueue();
    Object key = inp.readObject();
    while (key != null) {
        Object value = inp.readObject();
        put(key, value);
        key = inp.readObject();
    }
}

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

/**
 * The readObject method for the transient variable.
 *
 * @param in//from   w  w w.  j  a  va  2  s.c  o  m
 *          The ObjectInputStream.
 * @throws IOException
 *           IOException.
 * @throws ClassNotFoundException
 *           ClassNotFoundException.
 */
private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
    in.defaultReadObject();
}

From source file:com.ibm.jaggr.core.impl.layer.LayerImpl.java

/**
 * De-serialize this object from an ObjectInputStream
 * @param in The ObjectInputStream/*from  w ww  . j a v a  2  s. co m*/
 * @throws IOException
 * @throws ClassNotFoundException
 */
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
    // Call the default implementation to de-serialize our object
    in.defaultReadObject();
    // init transients
    _validateLastModified = new AtomicBoolean(true);
    _isReportCacheInfo = false;
}

From source file:org.apache.torque.util.LargeSelect.java

/**
 * Deserialize this LargeSelect instance.
 *
 * @param inputStream The serialization input stream.
 * @throws IOException/*from  w w w .ja  v a2 s .  co  m*/
 * @throws ClassNotFoundException
 */
private void readObject(ObjectInputStream inputStream) throws IOException, ClassNotFoundException {
    inputStream.defaultReadObject();

    // avoid NPE because of Tomcat de-serialization of sessions
    if (Torque.isInit()) {
        startQuery(pageSize);
    }
}