S
stevemflanagan
I have written up a technique for reading reading data using java.
Once the fields are defined, the actual reading can be automated. The
key is the use of Annotations to add information to the fields of the
class.
It emulates some of the C idiom of reading data directly into struct's
with pragma pack(1) that is miss so much in java.
So, if you do a lot of reading of different binary data blobs, this
technique might be useful. It can certainly be basis something much
more elegant that a bunch of getInt's, getByte's, etc, etc.
So have a look
http://codify.flansite.com/2009/05/c-struct-like-parsing-of-binary-data-with-java/
This would have certainly helped me on past projects...
Cheers!
Steve
Once the fields are defined, the actual reading can be automated. The
key is the use of Annotations to add information to the fields of the
class.
It emulates some of the C idiom of reading data directly into struct's
with pragma pack(1) that is miss so much in java.
So, if you do a lot of reading of different binary data blobs, this
technique might be useful. It can certainly be basis something much
more elegant that a bunch of getInt's, getByte's, etc, etc.
So have a look
http://codify.flansite.com/2009/05/c-struct-like-parsing-of-binary-data-with-java/
This would have certainly helped me on past projects...
Cheers!
Steve