How to get amount of serialized bytes representing a Java object?

前端 未结 6 418
执笔经年
执笔经年 2021-02-01 20:45

What syntax would I use to get the number of bytes representing a string and compare them to the number of bytes representing an ArrayList holding that string, for

6条回答
  •  粉色の甜心
    2021-02-01 21:19

    have a look at: http://www.javaworld.com/javaworld/javaqa/2003-12/02-qa-1226-sizeof.html

    closest thing that comes to mind would be serializing it and reading the num of bytes

提交回复
热议问题