【问题标题】:java serialize transient elementsjava序列化瞬态元素
【发布时间】:2017-03-05 20:04:47
【问题描述】:

我正在为一些 java t 准备 myselg,我在 java 代码中看到了一些有趣的东西:

在 ArrayList 类中我可以看到:

  /**
     * The array buffer into which the elements of the ArrayList are stored.
     * The capacity of the ArrayList is the length of this array buffer.
     */
    private transient Object[] elementData;

那么列表如何序列化保存数据的数组是否被定义为瞬态:?

他们是否使用了一些我们看不到的技巧,比如桥接方法、字段或类似的..

谢谢

【问题讨论】:

    标签: java serialization arraylist transient


    【解决方案1】:

    ArrayList 使用readObject() and writeObject() 进行序列化。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-03-30
      • 2010-12-27
      • 2015-10-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-04-22
      • 1970-01-01
      相关资源
      最近更新 更多