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:ucar.unidata.idv.control.chart.MyXYPlot.java

/**
 * Provides serialization support./*www . ja v  a  2s. 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.domainGridlineStroke = SerialUtilities.readStroke(stream);
    this.domainGridlinePaint = SerialUtilities.readPaint(stream);
    this.rangeGridlineStroke = SerialUtilities.readStroke(stream);
    this.rangeGridlinePaint = SerialUtilities.readPaint(stream);
    this.rangeZeroBaselineStroke = SerialUtilities.readStroke(stream);
    this.rangeZeroBaselinePaint = SerialUtilities.readPaint(stream);
    this.domainCrosshairStroke = SerialUtilities.readStroke(stream);
    this.domainCrosshairPaint = SerialUtilities.readPaint(stream);
    this.rangeCrosshairStroke = SerialUtilities.readStroke(stream);
    this.rangeCrosshairPaint = SerialUtilities.readPaint(stream);
    this.domainTickBandPaint = SerialUtilities.readPaint(stream);
    this.rangeTickBandPaint = SerialUtilities.readPaint(stream);
    this.quadrantOrigin = SerialUtilities.readPoint2D(stream);
    this.quadrantPaint = new Paint[4];
    for (int i = 0; i < 4; i++) {
        this.quadrantPaint[i] = SerialUtilities.readPaint(stream);
    }

    // register the plot as a listener with its axes, datasets, and 
    // renderers...
    int domainAxisCount = this.domainAxes.size();
    for (int i = 0; i < domainAxisCount; i++) {
        Axis axis = (Axis) this.domainAxes.get(i);
        if (axis != null) {
            axis.setPlot(this);
            axis.addChangeListener(this);
        }
    }
    int rangeAxisCount = this.rangeAxes.size();
    for (int i = 0; i < rangeAxisCount; i++) {
        Axis axis = (Axis) this.rangeAxes.get(i);
        if (axis != null) {
            axis.setPlot(this);
            axis.addChangeListener(this);
        }
    }
    int datasetCount = this.datasets.size();
    for (int i = 0; i < datasetCount; i++) {
        Dataset dataset = (Dataset) this.datasets.get(i);
        if (dataset != null) {
            dataset.addChangeListener(this);
        }
    }
    int rendererCount = this.renderers.size();
    for (int i = 0; i < rendererCount; i++) {
        XYItemRenderer renderer = (XYItemRenderer) this.renderers.get(i);
        if (renderer != null) {
            renderer.addChangeListener(this);
        }
    }

}

From source file:org.openid4java.httpclient.URI.java

/**
 * Read a URI./*from  w  w  w .  j a  va  2s .  c om*/
 *
 * @param ois the object-input stream
 * @throws ClassNotFoundException If one of the classes specified in the
 * input stream cannot be found.
 * @throws IOException If an IO problem occurs.
 */
protected void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {

    ois.defaultReadObject();
}

From source file:NavigableMap.java

/**
 * Reconstitute the <tt>Map</tt> instance from a stream.
 *///from   www .ja v  a 2s. com
private void readObject(final java.io.ObjectInputStream s) throws java.io.IOException, ClassNotFoundException {
    // Read in the Comparator and any hidden stuff
    s.defaultReadObject();
    // Reset transients
    initialize();

    /*
     * This is nearly identical to buildFromSorted, but is distinct because
     * readObject calls can't be nicely adapted as the kind of iterator needed
     * by buildFromSorted. (They can be, but doing so requires type cheats
     * and/or creation of adaptor classes.) It is simpler to just adapt the
     * code.
     */

    HeadIndex<K, V> h = head;
    Node<K, V> basepred = h.node;
    ArrayList<Index<K, V>> preds = new ArrayList<Index<K, V>>();
    for (int i = 0; i <= h.level; ++i)
        preds.add(null);
    Index<K, V> q = h;
    for (int i = h.level; i > 0; --i) {
        preds.set(i, q);
        q = q.down;
    }

    for (;;) {
        Object k = s.readObject();
        if (k == null)
            break;
        Object v = s.readObject();
        if (v == null)
            throw new NullPointerException();
        K key = (K) k;
        V val = (V) v;
        int j = randomLevel();
        if (j > h.level)
            j = h.level + 1;
        Node<K, V> z = new Node<K, V>(key, val, null);
        basepred.next = z;
        basepred = z;
        if (j > 0) {
            Index<K, V> idx = null;
            for (int i = 1; i <= j; ++i) {
                idx = new Index<K, V>(z, idx, null);
                if (i > h.level)
                    h = new HeadIndex<K, V>(h.node, h, idx, i);

                if (i < preds.size()) {
                    preds.get(i).right = idx;
                    preds.set(i, idx);
                } else
                    preds.add(idx);
            }
        }
    }
    head = h;
}

From source file:KIDLYAbstractRenderer.java

/**
 * Provides serialization support.//from  www  .  ja v  a  2  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.paint = SerialUtilities.readPaint(stream);
    this.basePaint = SerialUtilities.readPaint(stream);
    this.fillPaint = SerialUtilities.readPaint(stream);
    this.baseFillPaint = SerialUtilities.readPaint(stream);
    this.outlinePaint = SerialUtilities.readPaint(stream);
    this.baseOutlinePaint = SerialUtilities.readPaint(stream);
    this.stroke = SerialUtilities.readStroke(stream);
    this.baseStroke = SerialUtilities.readStroke(stream);
    this.outlineStroke = SerialUtilities.readStroke(stream);
    this.baseOutlineStroke = SerialUtilities.readStroke(stream);
    this.shape = SerialUtilities.readShape(stream);
    this.baseShape = SerialUtilities.readShape(stream);
    this.itemLabelPaint = SerialUtilities.readPaint(stream);
    this.baseItemLabelPaint = SerialUtilities.readPaint(stream);
    this.baseLegendShape = SerialUtilities.readShape(stream);
    this.baseLegendTextPaint = SerialUtilities.readPaint(stream);

    // listeners are not restored automatically, but storage must be
    // provided...
    this.listenerList = new EventListenerList();

}

From source file:com.microsoft.tfs.core.httpclient.URI.java

/**
 * Read a URI.//from   w  ww. jav  a2  s  . c  om
 *
 * @param ois
 *        the object-input stream
 * @throws ClassNotFoundException
 *         If one of the classes specified in the input stream cannot be
 *         found.
 * @throws IOException
 *         If an IO problem occurs.
 */
private void readObject(final ObjectInputStream ois) throws ClassNotFoundException, IOException {

    ois.defaultReadObject();
}

From source file:org.apache.openjpa.kernel.BrokerImpl.java

private void readObject(ObjectInputStream in) throws ClassNotFoundException, IOException {
    Object factoryKey = in.readObject();
    AbstractBrokerFactory factory = AbstractBrokerFactory.getPooledFactoryForKey(factoryKey);

    // this needs to happen before defaultReadObject so that it's
    // available for calls to broker.getConfiguration() during
    // StateManager deserialization
    _conf = factory.getConfiguration();// w w  w  . ja  v  a  2 s . c o m
    _repo = _conf.getMetaDataRepositoryInstance();

    in.defaultReadObject();
    factory.initializeBroker(_managed, _connRetainMode, this, true);

    // re-initialize the lock if needed.
    setMultithreaded(_multithreaded);

    // force recreation of set
    _operatingDirty = true;
    initializeOperatingSet();

    if (isActive() && _runtime instanceof LocalManagedRuntime)
        ((LocalManagedRuntime) _runtime).begin();
}

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

private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
    in.defaultReadObject();
    createTransientState();//from  w  w w  .  j  av a  2s  .c  om
}

From source file:org.hyperledger.fabric.sdk.Channel.java

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

    in.defaultReadObject();
    toString = "Channel{id: " + config.getNextID() + ", name: " + name + "}";
    initialized = false;/*from   w ww .j ava 2  s  .c om*/
    lastChaincodeUpgradeEventBlock = 0;
    shutdown = false;
    msps = new HashMap<>();
    txListeners = new LinkedHashMap<>();
    channelEventQue = new ChannelEventQue();
    blockListeners = new LinkedHashMap<>();
    peerEndpointMap = Collections.synchronizedMap(new HashMap<>());

    setSDPeerAddition(new SDOPeerDefaultAddition(getServiceDiscoveryProperties()));
    // sdOrdererAddition = DEFAULT_ORDERER_ADDITION;
    endorsementSelector = ServiceDiscovery.DEFAULT_ENDORSEMENT_SELECTION;
    chainCodeListeners = new LinkedHashMap<>();
    for (Peer peer : peers) {
        peerEndpointMap.put(peer.getEndpoint(), peer);
    }

    ordererEndpointMap = Collections.synchronizedMap(new HashMap<>());
    for (Orderer orderer : orderers) {
        ordererEndpointMap.put(orderer.getEndpoint(), orderer);
    }

    for (EventHub eventHub : getEventHubs()) {
        eventHub.setEventQue(channelEventQue);
    }

}

From source file:lasige.steeldb.jdbc.BFTRowSet.java

/**
 * This method re populates the resBundle
 * during the deserialization process//www .j av  a  2  s  . co m
 *
 */
protected void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
    // Default state initialization happens here
    ois.defaultReadObject();
    // Initialization of transient Res Bundle happens here .
    try {
        resBundle = JdbcRowSetResourceBundle.getJdbcRowSetResourceBundle();
    } catch (IOException ioe) {
        throw new RuntimeException(ioe);
    }

}