zoukankan      html  css  js  c++  java
  • 类 ObjectOutputStream的writeObject()方法的中英文对照

    类 ObjectOutputStream
    java.lang.Object
      java.io.OutputStream
          java.io.ObjectOutputStream
    所有已实现的接口:
    Closeable, DataOutput, Flushable, ObjectOutput, ObjectStreamConstants

    writeObject
    public final void writeObject(Object obj)
                           throws IOException


    Write the specified object to the ObjectOutputStream. The class of the object, the signature of the class, and the values of the non-transient and non-static fields of the class and all of its supertypes are written. Default serialization for a class can be overridden using the writeObject and the readObject methods. Objects referenced by this object are written transitively so that a complete equivalent graph of objects can be reconstructed by an ObjectInputStream.

    Exceptions are thrown for problems with the OutputStream and for classes that should not be serialized. All exceptions are fatal to the OutputStream, which is left in an indeterminate state, and it is up to the caller to ignore or recover the stream state.

    Throws:
    InvalidClassException Something is wrong with a class used by serialization.
    NotSerializableException Some object to be serialized does not implement the java.io.Serializable interface.
    IOException Any exception thrown by the underlying OutputStream.


    将指定的对象写入 ObjectOutputStream。对象的类、类的签名,以及类及其所有超类型的非瞬态和非静态字段的值都将被写入。可以使用 writeObject 和 readObject 方法重写类的默认序列化。由此对象引用的对象是以可变迁的方式写入的,这样,可以通过 ObjectInputStream 重新构造这些对象的完全等价的图形。

    当 OutputStream 中出现问题或者遇到不应序列化的类时,将抛出异常。所有异常对于 OutputStream 而言都是致命的,使其处于不确定状态;并由调用方来忽略或恢复流的状态。

    指定者:
    接口 ObjectOutput 中的 writeObject
    参数:
    obj - 要写入的对象
    抛出:
    InvalidClassException - 序列化操作使用的类出了问题。
    NotSerializableException - 某个要序列化的对象不能实现 java.io.Serializable 接口。
    IOException - 由基础 OutputStream 抛出的任何异常。

  • 相关阅读:
    [学习笔记]Nim游戏&SG函数
    [vijos1783][NOIP2012]疫情控制
    [vijos1782][NOIP2012]借教室
    [学习笔记]递推问题选讲
    [vijos1779][NOIP2012]国王游戏
    NET中使用三层构架如何从DAL层读取web.config中的数据库连接字符串!
    转:一个不错的网页进度条
    转:在没有数据时,如何使用FormView增加数据
    asp.net 2.0中的MessageBox.Show()方法
    TreeView与MultiView,View三个控件的组合使用
  • 原文地址:https://www.cnblogs.com/ctoroad/p/482834.html
Copyright © 2011-2022 走看看