Fastest way to write an array of integers to a file in Java?

前端 未结 6 484
小鲜肉
小鲜肉 2020-12-05 08:33

As the title says, I\'m looking for the fastest possible way to write integer arrays to files. The arrays will vary in size, and will realistically contain anywhere between

6条回答
  •  無奈伤痛
    2020-12-05 08:44

    Array is Serializable - can't you just use writer.writeObject(data);? That's definitely going to be faster than individual writeInt calls.

    If you have other requirements on the output data format than retrieval into int[], that's a different question.

提交回复
热议问题