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

The following are Jave code examples for showing how to use defaultWriteObject() of the java.io.ObjectOutputStream class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: OpenJSharp   File: BeanContextSupport.java   View Source Code Vote up 6 votes
/**
 * Serialize the BeanContextSupport, if this instance has a distinct
 * peer (that is this object is acting as a delegate for another) then
 * the children of this instance are not serialized here due to a
 * 'chicken and egg' problem that occurs on deserialization of the
 * children at the same time as this instance.
 *
 * Therefore in situations where there is a distinct peer to this instance
 * it should always call writeObject() followed by writeChildren() and
 * readObject() followed by readChildren().
 *
 * @param oos the ObjectOutputStream
 */

private synchronized void writeObject(ObjectOutputStream oos) throws IOException, ClassNotFoundException {
    serializing = true;

    synchronized (BeanContext.globalHierarchyLock) {
        try {
            oos.defaultWriteObject(); // serialize the BeanContextSupport object

            bcsPreSerializationHook(oos);

            if (serializable > 0 && this.equals(getBeanContextPeer()))
                writeChildren(oos);

            serialize(oos, (Collection)bcmListeners);
        } finally {
            serializing = false;
        }
    }
}
 
Example 2
Project: incubator-netbeans   File: PriorityListenerList.java   View Source Code Vote up 6 votes
private void writeObject(ObjectOutputStream s) throws IOException {
    s.defaultWriteObject();
    
    // Save serializable event listeners
    int priority = listenersArray.length - 1; // max priority
    s.writeInt(priority); // write max priority
    for (; priority >= 0; priority--) {
        T[] listeners = listenersArray[priority];
        // Write in opposite order of adding 
        for (int i = 0; i < listeners.length; i++) {
            T listener = listeners[i];
            // Save only the serializable listeners
            if (listener instanceof Serializable) {
                s.writeObject(listener);
            }
        }
        s.writeObject(null);
    }
}
 
Example 3
Project: whackpad   File: ObjArray.java   View Source Code Vote up 5 votes
private void writeObject(ObjectOutputStream os) throws IOException
{
    os.defaultWriteObject();
    int N = size;
    for (int i = 0; i != N; ++i) {
        Object obj = getImpl(i);
        os.writeObject(obj);
    }
}
 
Example 4
Project: HCFCore   File: TSynchronizedDoubleShortMap.java   View Source Code Vote up 4 votes
private void writeObject( ObjectOutputStream s ) throws IOException {
	synchronized( mutex ) { s.defaultWriteObject(); }
}
 
Example 5
Project: HCFCore   File: TSynchronizedFloatLongMap.java   View Source Code Vote up 4 votes
private void writeObject( ObjectOutputStream s ) throws IOException {
	synchronized( mutex ) { s.defaultWriteObject(); }
}
 
Example 6
Project: HCFCore   File: TSynchronizedDoubleShortMap.java   View Source Code Vote up 4 votes
private void writeObject( ObjectOutputStream s ) throws IOException {
	synchronized( mutex ) { s.defaultWriteObject(); }
}
 
Example 7
Project: HCFCore   File: HashMultiSet.java   View Source Code Vote up 4 votes
/**
 * Write the multiset out using a custom routine.
 */
private void writeObject(final ObjectOutputStream out) throws IOException {
    out.defaultWriteObject();
    super.doWriteObject(out);
}
 
Example 8
Project: guava-mock   File: Synchronized.java   View Source Code Vote up 4 votes
@GwtIncompatible // java.io.ObjectOutputStream
private void writeObject(ObjectOutputStream stream) throws IOException {
  synchronized (mutex) {
    stream.defaultWriteObject();
  }
}
 
Example 9
Project: bitcoinj-thin   File: Address.java   View Source Code Vote up 4 votes
private void writeObject(ObjectOutputStream out) throws IOException {
    out.defaultWriteObject();
    out.writeUTF(params.id);
}
 
Example 10
Project: xcc   File: TSynchronizedObjectDoubleMap.java   View Source Code Vote up 4 votes
private void writeObject( ObjectOutputStream s ) throws IOException {
	synchronized( mutex ) { s.defaultWriteObject(); }
}
 
Example 11
Project: openjdk-jdk10   File: CustomDefaultObjTrees.java   View Source Code Vote up 4 votes
private void writeObject(ObjectOutputStream out) throws IOException {
    out.defaultWriteObject();
}
 
Example 12
Project: jdk8u-jdk   File: InputMap.java   View Source Code Vote up 4 votes
private void writeObject(ObjectOutputStream s) throws IOException {
    s.defaultWriteObject();

    ArrayTable.writeArrayTable(s, arrayTable);
}
 
Example 13
Project: HCFCore   File: SynchronizedCollection.java   View Source Code Vote up 4 votes
private void writeObject( ObjectOutputStream s ) throws IOException {
	synchronized( mutex ) { s.defaultWriteObject(); }
}
 
Example 14
Project: googles-monorepo-demo   File: LongAdder.java   View Source Code Vote up 4 votes
private void writeObject(ObjectOutputStream s) throws IOException {
    s.defaultWriteObject();
    s.writeLong(sum());
}
 
Example 15
Project: HCFCore   File: TSynchronizedFloatDoubleMap.java   View Source Code Vote up 4 votes
private void writeObject( ObjectOutputStream s ) throws IOException {
	synchronized( mutex ) { s.defaultWriteObject(); }
}
 
Example 16
Project: xcc   File: TSynchronizedDoubleCollection.java   View Source Code Vote up 4 votes
private void writeObject( ObjectOutputStream s ) throws IOException {
	synchronized( mutex ) { s.defaultWriteObject(); }
}
 
Example 17
Project: HCFCore   File: TSynchronizedDoubleObjectMap.java   View Source Code Vote up 4 votes
private void writeObject( ObjectOutputStream s ) throws IOException {
	synchronized( mutex ) { s.defaultWriteObject(); }
}
 
Example 18
Project: parabuild-ci   File: XYPolygonAnnotation.java   View Source Code Vote up 3 votes
/**
 * Provides serialization support.
 *
 * @param stream  the output stream (<code>null</code> not permitted).
 *
 * @throws IOException if there is an I/O error.
 */
private void writeObject(ObjectOutputStream stream) throws IOException {
    stream.defaultWriteObject();
    SerialUtilities.writeStroke(this.stroke, stream);
    SerialUtilities.writePaint(this.outlinePaint, stream);
    SerialUtilities.writePaint(this.fillPaint, stream);
}
 
Example 19
Project: HCFCore   File: PredicatedMap.java   View Source Code Vote up 2 votes
/**
 * Write the map out using a custom routine.
 *
 * @param out  the output stream
 * @throws IOException
 * @since 3.1
 */
private void writeObject(final ObjectOutputStream out) throws IOException {
    out.defaultWriteObject();
    out.writeObject(map);
}
 
Example 20
Project: HCFCore   File: UnmodifiableMap.java   View Source Code Vote up 2 votes
/**
 * Write the map out using a custom routine.
 *
 * @param out  the output stream
 * @throws IOException
 * @since 3.1
 */
private void writeObject(final ObjectOutputStream out) throws IOException {
    out.defaultWriteObject();
    out.writeObject(map);
}