JavaFastPFOR icon indicating copy to clipboard operation
JavaFastPFOR copied to clipboard

Writing int[] into a file

Open mokun opened this issue 5 years ago • 1 comments

Assume I have 10,000 int, which range from -9000 to +21000 in value.

What would be the strategy of writing the int[] already compressed by JavaFastPFOR into a file for archive ?

Should I assume I need to convert each int into 4 bytes ?

So will an int[] array with 10,000 values will be saved as a byte[] array with the size of 40,000 ?

Any other more optimal way to save the data into a file ?

mokun avatar Nov 08 '19 18:11 mokun

Are you asking how to serialize an array of ints to disk?

You can either use a DataOutput or a ByteBuffer.

lemire avatar Nov 08 '19 21:11 lemire