Created
November 24, 2016 12:07
-
-
Save ques0942/813940d73b854dd7ed65eb7b4a992e01 to your computer and use it in GitHub Desktop.
(Java)serializeされるときのバイトサイズを計算する ref: http://qiita.com/ques0942/items/6452c09c34e0b34b8eb2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ByteArrayOutputStream baos = new ByteArrayOutputStream(); | |
ObjectOutputStream oos = new ObjectOutputStream(baos); | |
oos.writeObject(target); | |
oos.flush(); | |
oos.close(); | |
baos.toByteArray().length // ここで取得される値がバイトサイズ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SerializationUtils.serialize((Serializable) target).length // ここで取得される値がバイトサイズ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment