/**
* Deserializes this {@code DragSource}. This method first performs
* default deserialization. Next, this object's {@code FlavorMap} is
* deserialized by using the next object in the stream.
* If the resulting {@code FlavorMap} is {@code null}, this
* object's {@code FlavorMap} is set to the default FlavorMap for
* this thread's {@code ClassLoader}.
* Next, this object's listeners are deserialized by reading a
* {@code null}-terminated sequence of 0 or more key/value pairs
* from the stream:
* <ul>
* <li>If a key object is a {@code String} equal to
* {@code dragSourceListenerK}, a {@code DragSourceListener} is
* deserialized using the corresponding value object and added to this
* {@code DragSource}.
* <li>If a key object is a {@code String} equal to
* {@code dragSourceMotionListenerK}, a
* {@code DragSourceMotionListener} is deserialized using the
* corresponding value object and added to this {@code DragSource}.
* <li>Otherwise, the key/value pair is skipped.
* </ul>
*
* @see java.awt.datatransfer.SystemFlavorMap#getDefaultFlavorMap
* @since 1.4
*/
private void readObject(ObjectInputStream s)
throws ClassNotFoundException, IOException {
s.defaultReadObject();
// 'flavorMap' was written explicitly
flavorMap = (FlavorMap)s.readObject();
// Implementation assumes 'flavorMap' is never null.
if (flavorMap == null) {
flavorMap = SystemFlavorMap.getDefaultFlavorMap();
}
Object keyOrNull;
while (null != (keyOrNull = s.readObject())) {
String key = ((String)keyOrNull).intern();
if (dragSourceListenerK == key) {
addDragSourceListener((DragSourceListener)(s.readObject()));
} else if (dragSourceMotionListenerK == key) {
addDragSourceMotionListener(
(DragSourceMotionListener)(s.readObject()));
} else {
// skip value for unrecognized key
s.readObject();
}
}
}
DragSource.java 文件源码
java
阅读 25
收藏 0
点赞 0
评论 0
项目:openjdk9
作者:
评论列表
文章目录