Thursday, June 19, 2008 05:37 PM
I have a ByteBuffer, and I want to search for an int in that buffer. The reason is that sometimes, when I parse a file, the file is corrupted, and I need to find the next magic, which is an int, so I can get back to the split.
The method getInt in ByteBuffer is very convenient for me because:
A. I don't want the code that deals with the buffer, to know the byte order (in my case it's little endian).
B. I don't want to deal with the bytes on my own - usually it comes out nasty and inefficient.
I can write the "find" code myself, but I prefer asking you - is there a utility that contains methods such as find, count, last etc. for byte buffers?