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

The following examples show how to use java.io.ObjectOutputStream#defaultWriteObject() . 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
Source File: MBeanServerNotificationFilter.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * 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
Source File: JScrollPane.java    From Java8CN with 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 3
Source File: Multimaps.java    From codebuff with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/** @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 4
Source File: TFloatDoubleHashMap.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
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 5
Source File: SerializationDeadlock.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
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
Source File: SerializationDeadlock.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
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 7
Source File: ParentNode.java    From JDKSourceCode1.8 with 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 8
Source File: JPanel.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 9
Source File: CaseInsensitiveMap.java    From jphp with 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 10
Source File: JOptionPane.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
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 11
Source File: Bindings.java    From camunda-bpm-platform with 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
Source File: BeanContextChildSupport.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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 13
Source File: FunctionInitializer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
private void writeObject(final ObjectOutputStream out) throws IOException {
    out.defaultWriteObject();
    Type.writeTypeMap(invalidatedProgramPoints, out);
}
 
Example 14
Source File: Checkbox.java    From openjdk-jdk8u with GNU General Public License v2.0 3 votes vote down vote up
/**
 * 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 15
Source File: MenuItem.java    From TencentKona-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * 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
Source File: DropTarget.java    From jdk1.8-source-analysis with Apache License 2.0 3 votes vote down vote up
/**
 * 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 17
Source File: Cardumen_001_s.java    From coming with 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 18
Source File: ExtendedCategoryAxis.java    From ECG-Viewer with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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 File: ScatterRenderer.java    From buffer_bci with GNU General Public License v3.0 2 votes vote down vote up
/**
 * 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 20
Source File: ItemImpl.java    From sakai with 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();
}