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:it.scoppelletti.programmerpower.web.control.ActionBase.java

/**
 * Serializza l’oggetto./*w w w  . j  a v  a2  s  .  c o  m*/
 * 
 * @param      out Flusso di scrittura.
 * @serialData     Formato di default seguito dai messaggi:
 * 
 * <P><OL>
 * <LI>Numero dei messaggi.
 * <LI>Sequenza dei messaggi.
 * </OL></P> 
 */
private void writeObject(ObjectOutputStream out) throws IOException {
    out.defaultWriteObject();

    out.writeInt(myMessages.size());
    for (ActionMessage msg : myMessages) {
        out.writeObject(msg);
    }
}

From source file:IntObjectHashMap.java

/**
 * Save the state of the <tt>IntObjectHashMap</tt> instance to a stream (i.e.,
 * serialize it)./*w  w w. java 2  s  .  c  om*/
 *
 * @serialData The <i>capacity</i> of the IntObjectHashMap (the length of the
 * bucket array) is emitted (int), followed  by the
 * <i>size</i> of the IntObjectHashMap (the number of key-value
 * mappings), followed by the key (Object) and value (Object)
 * for each key-value mapping represented by the IntObjectHashMap
 * The key-value mappings are emitted in the order that they
 * are returned by <tt>entrySet().iterator()</tt>.
 */
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(size);

    // Write out keys and values (alternating)
    int c = 0;
    for (int i = 0; c < size && i < table.length; i++) {
        Entry e = table[i];
        for (; e != null; e = e.next, ++c) {
            s.writeInt(e.key);
            s.writeObject(e.getValue());
        }
    }
}

From source file:org.apache.axis.description.OperationDesc.java

private void writeObject(java.io.ObjectOutputStream out) throws IOException {
    out.defaultWriteObject();
    if (method != null) {
        out.writeObject(method.getDeclaringClass());
        out.writeObject(method.getName());
        out.writeObject(method.getParameterTypes());
    } else {/*from  www.  j ava 2 s.c om*/
        out.writeObject(null);
    }
}

From source file:com.projity.pm.assignment.HasAssignmentsImpl.java

private void writeObject(ObjectOutputStream s) throws IOException {
    s.defaultWriteObject();
}

From source file:org.jfree.experimental.chart.plot.dial.DialValueIndicator.java

/**
 * Provides serialization support.//from   w  w  w  .  j a  va 2s .  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.writePaint(this.paint, stream);
    SerialUtilities.writePaint(this.backgroundPaint, stream);
    SerialUtilities.writePaint(this.outlinePaint, stream);
    SerialUtilities.writeStroke(this.outlineStroke, stream);
}

From source file:mdb.ui.server.fileupload.MemoryFileItem.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 w w.j  a v  a  2  s  . com*/
private void writeObject(ObjectOutputStream out) throws IOException {
    // 
    cachedContent = get();

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

From source file:org.kuali.rice.krms.impl.repository.PropositionBo.java

private void writeObject(ObjectOutputStream stream) throws IOException, ClassNotFoundException {
    parameters.size();//from   w w w .  j  a  va2 s .  c o  m
    stream.defaultWriteObject();
}

From source file:de.tudarmstadt.ukp.wikipedia.revisionmachine.api.Revision.java

private void writeObject(ObjectOutputStream out) throws IOException {
    //load DiffParts before serializing
    getParts();/* ww  w  .ja v  a2s .co m*/
    //load revision text before serializing
    getRevisionText();
    //now we can serialize the object with the default write method
    out.defaultWriteObject();
}

From source file:org.pentaho.reporting.engine.classic.core.MasterReport.java

/**
 * A helper method that serializes the element object.
 *
 * @param stream//w w w.  ja v a2s .co m
 *          the stream to which the element should be serialized.
 * @throws IOException
 *           if an IO error occured or a property was not serializable.
 */
private void writeObject(final ObjectOutputStream stream) throws IOException {
    stream.defaultWriteObject();
    try {
        final DocumentBundle bundle = getBundle();
        stream.writeObject(bundle.getMetaData().getBundleType());

        final MemoryDocumentBundle mem = new MemoryDocumentBundle();
        BundleUtilities.copyStickyInto(mem, bundle);
        BundleUtilities.copyInto(mem, bundle, LegacyBundleResourceRegistry.getInstance().getRegisteredFiles(),
                true);
        BundleUtilities.copyMetaData(mem, bundle);
        mem.getWriteableDocumentMetaData().setBundleType("application/vnd.pentaho.serialized-bundle");
        final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        BundleUtilities.writeAsZip(outputStream, mem);
        stream.writeObject(outputStream.toByteArray());
    } catch (ContentIOException e) {
        throw new IOException("Unable to serialize the bundle", e);
    }
}

From source file:com.link_intersystems.lang.ref.AbstractSerializableReference.java

private void writeObject(ObjectOutputStream out) throws IOException {
    if (transientReferent != null) {
        try {/*from  w w  w . ja va  2 s .  c o m*/
            restoreInfo = serialize(transientReferent);
        } catch (SerializationException e) {
            throw e;
        } catch (Exception e) {
            Class<?> transientReferentClass = transientReferent.getClass();
            throw new SerializationException("Unable to serialize object of " + transientReferentClass, e);
        }
    }
    out.defaultWriteObject();
}