Example usage for java.io ObjectOutputStream defaultWriteObject

List of usage examples for java.io ObjectOutputStream defaultWriteObject

Introduction

In this page you can find the example usage for java.io ObjectOutputStream defaultWriteObject.

Prototype

public void defaultWriteObject() throws IOException 

Source Link

Document

Write the non-static and non-transient fields of the current class to this stream.

Usage

From source file:KIDLYRenderer.java

/**
 * Provides serialization support.// ww  w.  j a v  a  2 s .c om
 *
 * @param stream  the output stream.
 *
 * @throws IOException  if there is an I/O error.
 */
private void writeObject(ObjectOutputStream stream) throws IOException {
    stream.defaultWriteObject();
    SerialUtilities.writePaint(this.shadowPaint, stream);
}

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

/**    
 * Provides serialization support.    //from   ww  w . jav a2 s.  c om
 *    
 * @param stream  the output stream.    
 *    
 * @throws IOException  if there is an I/O error.    
 */
private void writeObject(ObjectOutputStream stream) throws IOException {
    stream.defaultWriteObject();
    SerialUtilities.writeShape(this.legendLine, stream);
}

From source file:com.cyberway.issue.crawler.frontier.AbstractFrontier.java

private void writeObject(java.io.ObjectOutputStream out) throws IOException {
    queuedUriCount = liveQueuedUriCount.get();
    succeededFetchCount = liveSucceededFetchCount.get();
    failedFetchCount = liveFailedFetchCount.get();
    disregardedUriCount = liveDisregardedUriCount.get();
    out.defaultWriteObject();
}

From source file:ConcurrentReaderHashMap.java

/**
 * Save the state of the <tt>ConcurrentReaderHashMap</tt> 
 * instance to a stream (i.e.,/*ww w .  ja v a2 s .co m*/
 * serialize it).
 *
 * @serialData The <i>capacity</i> of the 
 * ConcurrentReaderHashMap (the length of the
 * bucket array) is emitted (int), followed  by the
 * <i>size</i> of the ConcurrentReaderHashMap (the number of key-value
 * mappings), followed by the key (Object) and value (Object)
 * for each key-value mapping represented by the ConcurrentReaderHashMap
 * The key-value mappings are emitted in no particular order.
 */

private synchronized void writeObject(java.io.ObjectOutputStream s) throws IOException {
    // Write out the threshold, loadfactor, and any hidden stuff
    s.defaultWriteObject();

    // Write out number of buckets
    s.writeInt(table.length);

    // Write out size (number of Mappings)
    s.writeInt(count);

    // Write out keys and values (alternating)
    for (int index = table.length - 1; index >= 0; index--) {
        Entry entry = table[index];

        while (entry != null) {
            s.writeObject(entry.key);
            s.writeObject(entry.value);
            entry = entry.next;
        }
    }
}

From source file:edu.umd.cs.marmoset.modelClasses.Project.java

private void writeObject(ObjectOutputStream stream) throws IOException {
    stream.writeInt(serialMinorVersion);
    stream.defaultWriteObject();
}

From source file:org.libreplan.business.common.LibrePlanClassValidator.java

private void writeObject(ObjectOutputStream oos) throws IOException {
    ResourceBundle rb = messageBundle;
    MessageInterpolator interpolator = this.userInterpolator;
    if (rb != null && !(rb instanceof Serializable)) {
        messageBundle = null;/*from w  ww .j a  v  a  2  s  . c  om*/
        if (!isUserProvidedResourceBundle) {
            log.warn(
                    "Serializing a LibrePlanClassValidator with a non serializable ResourceBundle: ResourceBundle ignored");
        }
    }
    if (interpolator != null && !(interpolator instanceof Serializable)) {
        userInterpolator = null;
        log.warn("Serializing a non serializable MessageInterpolator");
    }
    oos.defaultWriteObject();
    oos.writeObject(messageBundle);
    oos.writeObject(userInterpolator);
    messageBundle = rb;
    userInterpolator = interpolator;
}

From source file:ConcurrentHashMap.java

/**
 * Save the state of the <tt>ConcurrentHashMap</tt> instance to a stream
 * (i.e., serialize it)./*  ww  w.j a v  a2 s  . c om*/
 * @param s 
 * @throws IOException 
 * 
 * @serialData An estimate of the table size, followed by the key (Object)
 *             and value (Object) for each key-value mapping, followed by a
 *             null pair. The key-value mappings are emitted in no
 *             particular order.
 */
private void writeObject(java.io.ObjectOutputStream s) throws IOException {
    // Write out the loadfactor, and any hidden stuff
    s.defaultWriteObject();

    // Write out capacity estimate. It is OK if this
    // changes during the write, since it is only used by
    // readObject to set initial capacity, to avoid needless resizings.

    int cap;
    synchronized (segments[0]) {
        cap = table.length;
    }
    s.writeInt(cap);

    // Write out keys and values (alternating)
    for (int k = 0; k < segments.length; ++k) {
        Segment seg = segments[k];
        Entry[] tab;
        synchronized (seg) {
            tab = table;
        }
        for (int i = k; i < tab.length; i += segments.length) {
            for (Entry e = tab[i]; e != null; e = e.next) {
                s.writeObject(e.key);
                s.writeObject(e.value);
            }
        }
    }

    s.writeObject(null);
    s.writeObject(null);
}

From source file:ConcurrentReaderHashMap.java

/**
 * Save the state of the <tt>ConcurrentReaderHashMap</tt> instance to a
 * stream (i.e., serialize it)./*from www  . ja  v  a2  s.  co m*/
 * @param s 
 * @throws IOException 
 * 
 * @serialData The <i>capacity</i> of the ConcurrentReaderHashMap (the
 *             length of the bucket array) is emitted (int), followed by the
 *             <i>size</i> of the ConcurrentReaderHashMap (the number of
 *             key-value mappings), followed by the key (Object) and value
 *             (Object) for each key-value mapping represented by the
 *             ConcurrentReaderHashMap The key-value mappings are emitted in
 *             no particular order.
 */
private synchronized void writeObject(java.io.ObjectOutputStream s) throws IOException {
    // Write out the threshold, loadfactor, and any hidden stuff
    s.defaultWriteObject();

    // Write out number of buckets
    s.writeInt(table.length);

    // Write out size (number of Mappings)
    s.writeInt(count);

    // Write out keys and values (alternating)
    for (int index = table.length - 1; index >= 0; index--) {
        Entry entry = table[index];

        while (entry != null) {
            s.writeObject(entry.key);
            s.writeObject(entry.value);
            entry = entry.next;
        }
    }
}

From source file:LinkedTransferQueue.java

/**
 * Saves the state to a stream (that is, serializes it).
 *
 * @serialData All of the elements (each an {@code E}) in
 * the proper order, followed by a null//from   w w  w.  j av a  2 s.com
 * @param s the stream
 */
private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException {
    s.defaultWriteObject();
    for (E e : this)
        s.writeObject(e);
    // Use trailing null as sentinel
    s.writeObject(null);
}

From source file:bin.spider.frame.uri.CrawlURI.java

/**
 * Custom serialization writing an empty 'outLinks' as null. Estimated
 * to save ~20 bytes in serialized form. 
 * /* w ww  .  j  a v  a 2 s . com*/
 * @param stream
 * @throws IOException
 */
private void writeObject(ObjectOutputStream stream) throws IOException {
    stream.defaultWriteObject();
    stream.writeObject((outLinks.isEmpty()) ? null : outLinks);
}