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

/**
 * Save the state of the <tt>IdentityHashMap</tt> instance to a stream (i.e.,
 * serialize it).//from  w ww .  j  a v  a2 s .  c o m
 *
 * @serialData The <i>capacity</i> of the IdentityHashMap (the length of the
 *             bucket array) is emitted (int), followed  by the
 *             <i>size</i> of the IdentityHashMap (the number of key-value
 *             mappings), followed by the key (Object) and value (Object)
 *             for each key-value mapping represented by the IdentityHashMap
 * The key-value mappings are emitted in no particular order.
 */
private 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:au.gov.ansto.bragg.nbi.restlet.fileupload.disk.DiskFileItem.java

/**
 * Writes the state of this object during serialization.
 *
 * @param out The stream to which the state should be written.
 *
 * @throws IOException if an error occurs.
 *//*from  w ww.j av  a 2 s  .c o m*/
private void writeObject(ObjectOutputStream out) throws IOException {
    // Read the data
    if (dfos.isInMemory()) {
        cachedContent = get();
    } else {
        cachedContent = null;
        dfosFile = dfos.getFile();
    }

    // write out values
    out.defaultWriteObject();
}

From source file:com.projity.pm.calendar.WorkingCalendar.java

private void writeObject(ObjectOutputStream s) throws IOException {
    serializedName = getName();/* w ww.  ja  v  a 2s  .  com*/
    if (baseCalendar == CalendarService.getInstance().getStandardInstance()) // don't serialize default base. treat it as null
        baseCalendar = null;
    s.defaultWriteObject();
    hasKey.serialize(s);
    if (baseCalendar == null)
        baseCalendar = CalendarService.getInstance().getStandardInstance(); // put it back so program will work
}

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

private void writeObject(ObjectOutputStream out) throws IOException {
    out.defaultWriteObject();
    out.writeUTF(secContext.getOwner().getName());
    out.writeObject(secContext.getFactory());
    out.writeObject(new MarshalledObject<>(run));
}

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

/**    
 * Provides serialization support.    /*  ww  w  .  j  a  va 2 s.c o  m*/
 *    
 * @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.legendBar, stream);
}

From source file:org.mule.DefaultMuleEvent.java

private void writeObject(ObjectOutputStream out) throws IOException {
    out.defaultWriteObject();
    // Can be null if service call originates from MuleClient
    if (serializedData != null) {
        Object serviceName = serializedData.get("serviceName");
        if (serviceName != null) {
            out.writeObject(serviceName);
        }/*from   w w  w  .  ja va2s .  co m*/
    } else {
        if (getFlowConstruct() != null) {
            out.writeObject(getFlowConstruct() != null ? getFlowConstruct().getName() : "null");
        }
    }
    for (Map.Entry<String, Object> entry : flowVariables.entrySet()) {
        Object value = entry.getValue();
        if (value != null && !(value instanceof Serializable)) {
            String message = String.format("Unable to serialize the flow variable %s, which is of type %s ",
                    entry.getKey(), value);
            logger.error(message);
            throw new IOException(message);
        }
    }

}

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

/**    
* Provides serialization support.    // w  ww .  j a va 2s.com
*    
* @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.upPaint, stream);
    SerialUtilities.writePaint(this.downPaint, stream);
    SerialUtilities.writePaint(this.volumePaint, stream);
}

From source file:mf.org.apache.xerces.dom.NodeImpl.java

private void writeObject(ObjectOutputStream out) throws IOException {
    if (needsSyncData()) {
        synchronizeData();/*from  www .java 2s  .com*/
    }
    out.defaultWriteObject();
}

From source file:org.eclipse.emf.teneo.mapping.elist.PersistableEList.java

/** Takes care of serializing the efeature */
private void writeObject(java.io.ObjectOutputStream out) throws IOException {
    EStructuralFeature estructuralFeatureOld = estructuralFeature;
    eFeaturePath = StoreUtil.structuralFeatureToString(estructuralFeature);
    // Commented to fix the bug due to which the attribute structuralFeature
    // was getting chnaged to null
    estructuralFeature = null;//from w w w . j  av a 2 s .  com
    additionalWriteObject();
    out.defaultWriteObject();
    estructuralFeature = estructuralFeatureOld;
}

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

/**
 *  Writes this object to the given output stream.
 *
 *  @param out  the output stream to write to
 *  @throws java.io.IOException  if the stream raises it
 *///from w  ww .  j av  a  2  s  .c o  m
private void writeObject(ObjectOutputStream out) throws IOException {
    out.defaultWriteObject();
    out.writeInt(table.length);

    // Have to use null-terminated list because size might shrink
    // during iteration

    for (Iterator iter = entrySet().iterator(); iter.hasNext();) {
        Map.Entry entry = (Map.Entry) iter.next();
        out.writeObject(entry.getKey());
        out.writeObject(entry.getValue());
    }
    out.writeObject(null);
}