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

The following examples show how to use java.io.ObjectInputStream#defaultReadObject() . 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: MenuItem.java    From jdk8u60 with 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
Source File: FastScatterPlot.java    From SIMVA-SoS with 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 3
Source File: InvalidTargetObjectTypeException.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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 4
Source File: Choice.java    From jdk-1.7-annotated with 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 5
Source File: InputMethodEvent.java    From Bytecoder with 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 File: THashMap.java    From gemfirexd-oss with 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 7
Source File: JLayer.java    From hottub with 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 8
Source File: ClientJobState.java    From scheduling with GNU Affero General Public License v3.0 4 votes vote down vote up
private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {
    ois.defaultReadObject();
    this.clientJobSerializationHelper.serializeTasks(this.tasks);
}
 
Example 9
Source File: ParserDelegator.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
private void readObject(ObjectInputStream s)
    throws ClassNotFoundException, IOException {
    s.defaultReadObject();
    setDefaultDTD();
}
 
Example 10
Source File: TreeBag.java    From Penetration_Testing_POC with 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 11
Source File: ModelMBeanNotificationInfo.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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 12
Source File: cfLOG.java    From openbd-core with 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 13
Source File: DataTypeManagerChangeListenerHandler.java    From ghidra with Apache License 2.0 4 votes vote down vote up
private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {
	ois.defaultReadObject();
	listenerList = WeakDataStructureFactory.createCopyOnReadWeakSet();
}
 
Example 14
Source File: SymbolAxis.java    From astor with 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 15
Source File: DialCap.java    From openstock with 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 16
Source File: TextAnnotation.java    From buffer_bci with GNU General Public License v3.0 2 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);
}
 
Example 17
Source File: BeanContextChildSupport.java    From openjdk-jdk9 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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
Source File: RecordDefinition.java    From sis with 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 19
Source File: URI.java    From knopflerfish.org with BSD 3-Clause "New" or "Revised" License 2 votes vote down vote up
/**
 * 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();
}
 
Example 20
Source File: CompositeTitle.java    From buffer_bci with GNU General Public License v3.0 2 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.backgroundPaint = SerialUtilities.readPaint(stream);
}