Here's my problem: one big gzipped file; millions of messages.
Each message consists of:
***************** *************** ******************
* 2-byte LENGTH * * 1-byte TYPE * * N-byte PAYLOAD * , where N = (LENGTH-1).
***************** *************** ******************
Depending on the TYPE
, I need to read a few bytes from an offset in the PAYLOAD
and choose to accept or reject the message.
I know how to do this sort of thing using java.io.DataInputStream, but this seems like a perfect application of java.nio.ByteBuffer (see here!). However, I need some help setting it up.
So, how do I use ByteBuffer to read messages from my gzipped file?
Update
I guess what I'd like to see is a skeletal implementation of code that could get me on the right track to using ByteBuffer effectively. Thanks!