I have a sequence of Integers in the following format:
Integer1 Integer2 Integer3 Integer4 Integer5 ....
Each four consective integers corresponds to values of a single record. So, I cannot really order them.
What would be the best way to compress such file?
Updates:
1- The values are indpendent of each other. Each 4 consective integers represents a record, for example:
CustomerId PurchaseId Products MoneySpent
Each hold an integer value.
2- Ideally I would like to have it compressed as an object and on disk.
Thanks
The simplest and most compatible approach is to GZIP the file as you write it by wrapping your stream with GZIPOutputStream and reading it wrapped with GZIPInputStream.