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:uk.q3c.krail.core.ui.ScopedUI.java

@SuppressWarnings("Duplicates")
private void readObject(ObjectInputStream inputStream) throws ClassNotFoundException, IOException {
    beforeDeserialization();/*from   ww w  . j av a 2 s  . c o  m*/
    inputStream.defaultReadObject();
    beforeTransientInjection();
    serializationSupport.injectTransientFields(this);
    afterTransientInjection();
    serializationSupport.checkForNullTransients();
}

From source file:nl.strohalm.cyclos.utils.jfreeAsymmetric.AsymmetricStatisticalBarRenderer.java

/**
 * Provides serialization support./*from   w  w  w . j  a va2  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(final ObjectInputStream stream) throws IOException, ClassNotFoundException {
    stream.defaultReadObject();
    errorIndicatorPaint = SerialUtilities.readPaint(stream);
}

From source file:de.jwic.base.Control.java

/**
 * Get new logger after deserialization.
 * @param s//from  w w w  .  jav  a 2  s.  c o  m
 * @throws IOException
 */
private void readObject(ObjectInputStream s) throws IOException {
    try {
        s.defaultReadObject();
    } catch (ClassNotFoundException e) {
        throw new IOException("ClassNotFound in readObject");
    }
    log = LogFactory.getLog(getClass());
}

From source file:blue.automation.Parameter.java

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

    line.addTableModelListener(this);
}

From source file:com.healthmarketscience.rmiio.DirectRemoteInputStream.java

/**
 * Reads the state of this object and all of the underlying stream's data
 * directly from the given ObjectInputStream. The stream data is stored in
 * a temporary file in the default java temp directory with the name {@code "stream_<num>.dat"}.
 *///from  w  w w . ja v  a2  s .  c o  m
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
    in.defaultReadObject();

    // read the default chunk size from the incoming file
    final int defaultChunkSize = in.readInt();
    checkChunkSize(defaultChunkSize);

    // setup a temp file for the incoming data (make sure it gets cleaned up
    // somehow)
    _tmpFile = File.createTempFile("stream_", ".dat");
    _tmpFile.deleteOnExit();

    FileOutputStream out = new FileOutputStream(_tmpFile);
    try {
        // limit buffer size in case of malicious input
        byte[] transferBuf = new byte[Math.min(defaultChunkSize, RemoteInputStreamServer.DEFAULT_CHUNK_SIZE)];
        while (true) {

            // read in another chunk
            int chunkCode = in.read();
            if (chunkCode == EOF_CODE) {
                // all done
                break;
            }

            int readLen = defaultChunkSize;
            if (chunkCode != DEFAULT_CHUNK_CODE) {
                readLen = in.readInt();
                checkChunkSize(readLen);
            }

            // copy chunk into temp file
            copy(in, out, transferBuf, readLen);

        }

        // attempt to close the temp file. if successful, we're good to go
        out.close();

        // sweet, setup final state
        _monitor = RemoteInputStreamServer.DUMMY_MONITOR;
        _in = new BufferedInputStream(new FileInputStream(_tmpFile));

        // the underlying stream is now in it's initial state
        _consumptionState = ConsumptionState.NONE;
        _gotEOF = false;

    } finally {
        RmiioUtil.closeQuietly(out);
    }

}

From source file:it.unimi.di.big.mg4j.document.TRECDocumentCollection.java

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

    final long size = s.readLong();
    final ObjectBigArrayBigList<TRECDocumentDescriptor> descriptors = new ObjectBigArrayBigList<TRECDocumentDescriptor>();
    descriptors.ensureCapacity(size);/*from  w ww . j  ava2 s.c o  m*/
    for (int i = 0; i < size; i++)
        descriptors.add(new TRECDocumentDescriptor(s.readInt(), s.readLong(), s.readInt(), s.readInt()));
    this.descriptors = descriptors;
}

From source file:com.alibaba.wasp.jdbcx.JdbcDataSource.java

/**
 * Called when de-serializing the object.
 * //from w  w w .ja v  a  2s  .c  o m
 * @param in
 *          the input stream
 */
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
    initFactory();
    in.defaultReadObject();
}

From source file:org.kepler.objectmanager.cache.DataCacheObject.java

/**
 * Custom deserialization method. Need to initialize mListeners to empty
 * vector./*  www  .  j  av a  2 s  .  co  m*/
 * 
 * @param ois
 * @throws IOException
 * @throws ClassNotFoundException
 */
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
    ois.defaultReadObject();
    mListeners = new Vector();
}

From source file:ddf.catalog.data.impl.MetacardTypeImpl.java

/**
 * Deserializes this {@link MetacardTypeImpl} instance.
 *
 * @param stream the {@link ObjectInputStream} that contains the bytes of the object
 * @throws IOException// w w w. ja va 2s. co  m
 * @throws ClassNotFoundException
 */
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {

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

    int numElements = stream.readInt();

    descriptors = new HashMap<>();

    for (int i = 0; i < numElements; i++) {
        AttributeDescriptor descriptor = (AttributeDescriptor) stream.readObject();
        descriptors.put(descriptor.getName(), descriptor);
    }
}

From source file:it.unimi.dsi.util.Properties.java

private void readObject(final ObjectInputStream s) throws IOException, ClassNotFoundException {
    s.defaultReadObject();
    try {//from w  ww  . jav  a 2 s  .c o m
        load(s);
    } catch (ConfigurationException e) {
        throw new RuntimeException(e);
    }
}