Java Code Examples for java.io.ObjectOutputStream#defaultWriteObject()

The following examples show how to use java.io.ObjectOutputStream#defaultWriteObject() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
/**
 * Serializes an {@link MBeanServerNotificationFilter} to an {@link ObjectOutputStream}.
 */
private void writeObject(ObjectOutputStream out)
        throws IOException {
  if (compat)
  {
    // Serializes this instance in the old serial form
    //
    ObjectOutputStream.PutField fields = out.putFields();
    fields.put("mySelectObjNameList", selectedNames);
    fields.put("myDeselectObjNameList", deselectedNames);
    out.writeFields();
  }
  else
  {
    // Serializes this instance in the new serial form
    //
    out.defaultWriteObject();
  }
}
 
Example 2
private void writeObject(final ObjectOutputStream oos)
        throws IOException {
    oos.defaultWriteObject();
    // Wait until all test threads have started serializing data
    try {
        await();
    } catch (final Exception e) {
        throw new IOException("Test ERROR: Unexpected exception caught", e);
    }
}
 
Example 3
Source Project: JDKSourceCode1.8   File: ParentNode.java    License: MIT License 5 votes vote down vote up
/** Serialize object. */
private void writeObject(ObjectOutputStream out) throws IOException {

    // synchronize chilren
    if (needsSyncChildren()) {
        synchronizeChildren();
    }
    // write object
    out.defaultWriteObject();

}
 
Example 4
/**
 * See readObject() and writeObject() in JComponent for more
 * information about serialization in Swing.
 */
private void writeObject(ObjectOutputStream s) throws IOException {
    s.defaultWriteObject();
    if (getUIClassID().equals(uiClassID)) {
        byte count = JComponent.getWriteObjCounter(this);
        JComponent.setWriteObjCounter(this, --count);
        if (count == 0 && ui != null) {
            ui.installUI(this);
        }
    }
}
 
Example 5
private void writeObject(final ObjectOutputStream oos)
        throws IOException {
    oos.defaultWriteObject();
    // Wait until all test threads have started serializing data
    try {
        await();
    } catch (final Exception e) {
        throw new IOException("Test ERROR: Unexpected exception caught", e);
    }
}
 
Example 6
private void writeObject(ObjectOutputStream stream)
    throws IOException {
    stream.defaultWriteObject();

    // number of entries
    stream.writeInt(_size);

    SerializationProcedure writeProcedure = new SerializationProcedure(stream);
    if (! forEachEntry(writeProcedure)) {
        throw writeProcedure.exception;
    }
}
 
Example 7
/** @serialData the factory and the backing map */

    @GwtIncompatible // java.io.ObjectOutputStream
    private void writeObject(ObjectOutputStream stream) throws IOException {
      stream.defaultWriteObject();
      stream.writeObject(factory);
      stream.writeObject(backingMap());
    }
 
Example 8
Source Project: Java8CN   File: JScrollPane.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * See <code>readObject</code> and <code>writeObject</code> in
 * <code>JComponent</code> for more
 * information about serialization in Swing.
 */
private void writeObject(ObjectOutputStream s) throws IOException {
    s.defaultWriteObject();
    if (getUIClassID().equals(uiClassID)) {
        byte count = JComponent.getWriteObjCounter(this);
        JComponent.setWriteObjCounter(this, --count);
        if (count == 0 && ui != null) {
            ui.installUI(this);
        }
    }
}
 
Example 9
private void writeObject(final ObjectOutputStream out) throws IOException {
    out.defaultWriteObject();
    Type.writeTypeMap(invalidatedProgramPoints, out);
}
 
Example 10
/**
 * Write the persistence state of the object.
 */

private void writeObject(ObjectOutputStream oos) throws IOException {

    /*
     * don't serialize if we are delegated and the delegator is not also
     * serializable.
     */

    if (!equals(beanContextChildPeer) && !(beanContextChildPeer instanceof Serializable))
        throw new IOException("BeanContextChildSupport beanContextChildPeer not Serializable");

    else
        oos.defaultWriteObject();

}
 
Example 11
Source Project: camunda-bpm-platform   File: Bindings.java    License: Apache License 2.0 4 votes vote down vote up
private void writeObject(ObjectOutputStream out) throws IOException, ClassNotFoundException {
	out.defaultWriteObject();
	out.writeObject(method.getDeclaringClass());
	out.writeObject(method.getName());
	out.writeObject(method.getParameterTypes());
}
 
Example 12
private void writeObject(ObjectOutputStream s) throws IOException {
    Vector<Object> values = new Vector<Object>();

    s.defaultWriteObject();
    // Save the icon, if its Serializable.
    if(icon != null && icon instanceof Serializable) {
        values.addElement("icon");
        values.addElement(icon);
    }
    // Save the message, if its Serializable.
    if(message != null && message instanceof Serializable) {
        values.addElement("message");
        values.addElement(message);
    }
    // Save the treeModel, if its Serializable.
    if(options != null) {
        Vector<Object> serOptions = new Vector<Object>();

        for(int counter = 0, maxCounter = options.length;
            counter < maxCounter; counter++)
            if(options[counter] instanceof Serializable)
                serOptions.addElement(options[counter]);
        if(serOptions.size() > 0) {
            int             optionCount = serOptions.size();
            Object[]        arrayOptions = new Object[optionCount];

            serOptions.copyInto(arrayOptions);
            values.addElement("options");
            values.addElement(arrayOptions);
        }
    }
    // Save the initialValue, if its Serializable.
    if(initialValue != null && initialValue instanceof Serializable) {
        values.addElement("initialValue");
        values.addElement(initialValue);
    }
    // Save the value, if its Serializable.
    if(value != null && value instanceof Serializable) {
        values.addElement("value");
        values.addElement(value);
    }
    // Save the selectionValues, if its Serializable.
    if(selectionValues != null) {
        boolean            serialize = true;

        for(int counter = 0, maxCounter = selectionValues.length;
            counter < maxCounter; counter++) {
            if(selectionValues[counter] != null &&
               !(selectionValues[counter] instanceof Serializable)) {
                serialize = false;
                break;
            }
        }
        if(serialize) {
            values.addElement("selectionValues");
            values.addElement(selectionValues);
        }
    }
    // Save the inputValue, if its Serializable.
    if(inputValue != null && inputValue instanceof Serializable) {
        values.addElement("inputValue");
        values.addElement(inputValue);
    }
    // Save the initialSelectionValue, if its Serializable.
    if(initialSelectionValue != null &&
       initialSelectionValue instanceof Serializable) {
        values.addElement("initialSelectionValue");
        values.addElement(initialSelectionValue);
    }
    s.writeObject(values);
}
 
Example 13
Source Project: jphp   File: CaseInsensitiveMap.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Write the map out using a custom routine.
 */
private void writeObject(ObjectOutputStream out) throws IOException {
    out.defaultWriteObject();
    doWriteObject(out);
}
 
Example 14
/**
 * Serializes this <code>DropTarget</code>. Performs default serialization,
 * and then writes out this object's <code>DropTargetListener</code> if and
 * only if it can be serialized. If not, <code>null</code> is written
 * instead.
 *
 * @serialData The default serializable fields, in alphabetical order,
 *             followed by either a <code>DropTargetListener</code>
 *             instance, or <code>null</code>.
 * @since 1.4
 */
private void writeObject(ObjectOutputStream s) throws IOException {
    s.defaultWriteObject();

    s.writeObject(SerializationTester.test(dtListener)
                  ? dtListener : null);
}
 
Example 15
/**
 * Writes default serializable fields to stream.  Writes
 * a list of serializable <code>ActionListeners</code>
 * as optional data. The non-serializable listeners are
 * detected and no attempt is made to serialize them.
 *
 * @param s the <code>ObjectOutputStream</code> to write
 * @serialData <code>null</code> terminated sequence of 0
 *   or more pairs; the pair consists of a <code>String</code>
 *   and an <code>Object</code>; the <code>String</code>
 *   indicates the type of object and is one of the following:
 *   <code>actionListenerK</code> indicating an
 *     <code>ActionListener</code> object
 *
 * @see AWTEventMulticaster#save(ObjectOutputStream, String, EventListener)
 * @see #readObject(ObjectInputStream)
 */
private void writeObject(ObjectOutputStream s)
  throws IOException
{
  s.defaultWriteObject();

  AWTEventMulticaster.save(s, actionListenerK, actionListener);
  s.writeObject(null);
}
 
Example 16
/**
 * Writes default serializable fields to stream.  Writes
 * a list of serializable <code>ItemListeners</code>
 * as optional data.  The non-serializable
 * <code>ItemListeners</code> are detected and
 * no attempt is made to serialize them.
 *
 * @param s the <code>ObjectOutputStream</code> to write
 * @serialData <code>null</code> terminated sequence of 0
 *   or more pairs; the pair consists of a <code>String</code>
 *   and an <code>Object</code>; the <code>String</code> indicates
 *   the type of object and is one of the following:
 *   <code>itemListenerK</code> indicating an
 *     <code>ItemListener</code> object
 *
 * @see AWTEventMulticaster#save(ObjectOutputStream, String, EventListener)
 * @see java.awt.Component#itemListenerK
 * @see #readObject(ObjectInputStream)
 */
private void writeObject(ObjectOutputStream s)
  throws java.io.IOException
{
  s.defaultWriteObject();

  AWTEventMulticaster.save(s, itemListenerK, itemListener);
  s.writeObject(null);
}
 
Example 17
/**
 * Provides serialization support.
 *
 * @param stream the output stream.
 * @throws java.io.IOException if there is an I/O error.
 */
private void writeObject(ObjectOutputStream stream) throws IOException {
    stream.defaultWriteObject();

}
 
Example 18
/**
 * Provides serialization support.
 *
 * @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.sublabelPaint, stream);
}
 
Example 19
Source Project: coming   File: Cardumen_001_s.java    License: MIT License 2 votes vote down vote up
/**
 * Handles serialization.
 *
 * @param stream  the output stream.
 *
 * @throws IOException if there is an I/O problem.
 */
private void writeObject(ObjectOutputStream stream) throws IOException {
    stream.defaultWriteObject();
}
 
Example 20
Source Project: sakai   File: ItemImpl.java    License: Educational Community License v2.0 2 votes vote down vote up
/**
 * implements Serializable
 * @param out
 * @throws IOException
 */
private void writeObject(ObjectOutputStream out)
    throws IOException{
  out.defaultWriteObject();
}