Java Code Examples for java.io.ObjectInputStream#defaultReadObject()

The following examples show how to use java.io.ObjectInputStream#defaultReadObject() . 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
Source Project: jdk8u60   File: MenuItem.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Reads the <code>ObjectInputStream</code> and if it
 * isn't <code>null</code> adds a listener to receive
 * action events fired by the <code>Menu</code> Item.
 * Unrecognized keys or values will be ignored.
 *
 * @param s the <code>ObjectInputStream</code> to read
 * @exception HeadlessException if
 *   <code>GraphicsEnvironment.isHeadless</code> returns
 *   <code>true</code>
 * @see #removeActionListener(ActionListener)
 * @see #addActionListener(ActionListener)
 * @see #writeObject(ObjectOutputStream)
 */
private void readObject(ObjectInputStream s)
  throws ClassNotFoundException, IOException, HeadlessException
{
  // HeadlessException will be thrown from MenuComponent's readObject
  s.defaultReadObject();

  Object keyOrNull;
  while(null != (keyOrNull = s.readObject())) {
    String key = ((String)keyOrNull).intern();

    if (actionListenerK == key)
      addActionListener((ActionListener)(s.readObject()));

    else // skip value for unrecognized key
      s.readObject();
  }
}
 
Example 2
/**
 * Deserializes an {@link InvalidTargetObjectTypeException} from an {@link ObjectInputStream}.
 */
private void readObject(ObjectInputStream in)
        throws IOException, ClassNotFoundException {
  if (compat)
  {
    // Read an object serialized in the old serial form
    //
    ObjectInputStream.GetField fields = in.readFields();
    exception = (Exception) fields.get("relatedExcept", null);
    if (fields.defaulted("relatedExcept"))
    {
      throw new NullPointerException("relatedExcept");
    }
  }
  else
  {
    // Read an object serialized in the new serial form
    //
    in.defaultReadObject();
  }
}
 
Example 3
Source Project: jdk-1.7-annotated   File: Choice.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Reads the <code>ObjectInputStream</code> and if it
 * isn't <code>null</code> adds a listener to receive
 * item events fired by the <code>Choice</code> item.
 * Unrecognized keys or values will be ignored.
 *
 * @param s the <code>ObjectInputStream</code> to read
 * @exception HeadlessException if
 *   <code>GraphicsEnvironment.isHeadless</code> returns
 *   <code>true</code>
 * @serial
 * @see #removeItemListener(ItemListener)
 * @see #addItemListener(ItemListener)
 * @see java.awt.GraphicsEnvironment#isHeadless
 * @see #writeObject(ObjectOutputStream)
 */
private void readObject(ObjectInputStream s)
  throws ClassNotFoundException, IOException, HeadlessException
{
  GraphicsEnvironment.checkHeadless();
  s.defaultReadObject();

  Object keyOrNull;
  while(null != (keyOrNull = s.readObject())) {
    String key = ((String)keyOrNull).intern();

    if (itemListenerK == key)
      addItemListener((ItemListener)(s.readObject()));

    else // skip value for unrecognized key
      s.readObject();
  }
}
 
Example 4
Source Project: SIMVA-SoS   File: FastScatterPlot.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Provides serialization support.
 *
 * @param stream  the input stream.
 *
 * @throws IOException  if there is an I/O error.
 * @throws ClassNotFoundException  if there is a classpath problem.
 */
private void readObject(ObjectInputStream stream)
        throws IOException, ClassNotFoundException {
    stream.defaultReadObject();

    this.paint = SerialUtilities.readPaint(stream);
    this.domainGridlineStroke = SerialUtilities.readStroke(stream);
    this.domainGridlinePaint = SerialUtilities.readPaint(stream);

    this.rangeGridlineStroke = SerialUtilities.readStroke(stream);
    this.rangeGridlinePaint = SerialUtilities.readPaint(stream);

    if (this.domainAxis != null) {
        this.domainAxis.addChangeListener(this);
    }

    if (this.rangeAxis != null) {
        this.rangeAxis.addChangeListener(this);
    }
}
 
Example 5
Source Project: Bytecoder   File: InputMethodEvent.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Initializes the {@code when} field if it is not present in the
 * object input stream. In that case, the field will be initialized by
 * invoking {@link java.awt.EventQueue#getMostRecentEventTime()}.
 */
private void readObject(ObjectInputStream s) throws ClassNotFoundException, IOException {
    s.defaultReadObject();
    if (when == 0) {
        // Can't use getMostRecentEventTimeForSource because source is always null during deserialization
        when = EventQueue.getMostRecentEventTime();
    }
}
 
Example 6
Source Project: hottub   File: JLayer.java    License: GNU General Public License v2.0 5 votes vote down vote up
private void readObject(ObjectInputStream s)
        throws IOException, ClassNotFoundException {
    s.defaultReadObject();
    if (layerUI != null) {
        setUI(layerUI);
    }
    if (eventMask != 0) {
        eventController.updateAWTEventListener(0, eventMask);
    }
}
 
Example 7
Source Project: gemfirexd-oss   File: THashMap.java    License: Apache License 2.0 5 votes vote down vote up
private void readObject(ObjectInputStream stream)
    throws IOException, ClassNotFoundException {
    stream.defaultReadObject();

    int size = stream.readInt();
    setUp(size);
    while (size-- > 0) {
        Object key = stream.readObject();
        Object val = stream.readObject();
        put(key, val);
    }
}
 
Example 8
private void readObject(ObjectInputStream s)
    throws ClassNotFoundException, IOException {
    s.defaultReadObject();
    setDefaultDTD();
}
 
Example 9
Source Project: Penetration_Testing_POC   File: TreeBag.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Read the bag in using a custom routine.
 */
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
    in.defaultReadObject();
    Comparator comp = (Comparator) in.readObject();
    super.doReadObject(new TreeMap(comp), in);
}
 
Example 10
/**
 * Deserializes a {@link ModelMBeanNotificationInfo} from an
 * {@link ObjectInputStream}.
 **/
private void readObject(ObjectInputStream in)
    throws IOException, ClassNotFoundException {
    // New serial form ignores extra field "currClass"
    in.defaultReadObject();
}
 
Example 11
Source Project: openbd-core   File: cfLOG.java    License: GNU General Public License v3.0 4 votes vote down vote up
private void readObject( ObjectInputStream aInputStream ) throws ClassNotFoundException, IOException {
	// always perform the default de-serialization first
	aInputStream.defaultReadObject();

	initLogDir();
}
 
Example 12
private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {
	ois.defaultReadObject();
	listenerList = WeakDataStructureFactory.createCopyOnReadWeakSet();
}
 
Example 13
private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {
    ois.defaultReadObject();
    this.clientJobSerializationHelper.serializeTasks(this.tasks);
}
 
Example 14
Source Project: openstock   File: DialCap.java    License: GNU General Public License v3.0 3 votes vote down vote up
/**
 * Provides serialization support.
 *
 * @param stream  the input stream.
 *
 * @throws IOException  if there is an I/O error.
 * @throws ClassNotFoundException  if there is a classpath problem.
 */
private void readObject(ObjectInputStream stream)
        throws IOException, ClassNotFoundException {
    stream.defaultReadObject();
    this.fillPaint = SerialUtilities.readPaint(stream);
    this.outlinePaint = SerialUtilities.readPaint(stream);
    this.outlineStroke = SerialUtilities.readStroke(stream);
}
 
Example 15
Source Project: astor   File: SymbolAxis.java    License: GNU General Public License v2.0 3 votes vote down vote up
/**
 * Provides serialization support.
 *
 * @param stream  the input stream.
 *
 * @throws IOException  if there is an I/O error.
 * @throws ClassNotFoundException  if there is a classpath problem.
 */
private void readObject(ObjectInputStream stream)
    throws IOException, ClassNotFoundException {
    stream.defaultReadObject();
    this.gridBandPaint = SerialUtilities.readPaint(stream);
    this.gridBandAlternatePaint = SerialUtilities.readPaint(stream);
}
 
Example 16
/**
 * Provides serialization support.
 *
 * @param stream  the input stream.
 *
 * @throws IOException  if there is an I/O error.
 * @throws ClassNotFoundException  if there is a classpath problem.
 */
private void readObject(ObjectInputStream stream)
        throws IOException, ClassNotFoundException {
    stream.defaultReadObject();
    this.backgroundPaint = SerialUtilities.readPaint(stream);
}
 
Example 17
/**
 * Restore a persistent object, must wait for subsequent setBeanContext()
 * to fully restore any resources obtained from the new nesting
 * BeanContext
 */

private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
    ois.defaultReadObject();
}
 
Example 18
/**
 * Provides serialization support.
 *
 * @param stream  the input stream.
 *
 * @throws IOException  if there is an I/O error.
 * @throws ClassNotFoundException  if there is a classpath problem.
 */
private void readObject(ObjectInputStream stream)
    throws IOException, ClassNotFoundException {
    stream.defaultReadObject();
    this.paint = SerialUtilities.readPaint(stream);
}
 
Example 19
Source Project: sis   File: RecordDefinition.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Invoked on deserialization for restoring the transient fields.
 *
 * @param  in  the input stream from which to deserialize an attribute.
 * @throws IOException if an I/O error occurred while reading or if the stream contains invalid data.
 * @throws ClassNotFoundException if the class serialized on the stream is not on the classpath.
 */
private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
    in.defaultReadObject();
    computeTransientFields(recordType.getMemberTypes());
}
 
Example 20
/**
 * Read a URI.
 *
 * @param ois the object-input stream
 * @throws ClassNotFoundException If one of the classes specified in the
 * input stream cannot be found.
 * @throws IOException If an IO problem occurs.
 */
private void readObject(ObjectInputStream ois)
    throws ClassNotFoundException, IOException {

    ois.defaultReadObject();
}