Gregory said:
You're right, but using String(byteArray1, charsetName) for your
String definitions would remove platform-dependence and could very
well be analagous to what the OP was after.
Could be. The requirements would be that the charset:
1. Is a straight 8-bit character encoding.
2. Contains a unique character mapping for each possible byte value.
A violation of the first rule would skew the indexOf result, and would
also create the danger that the beginning of a match in the byte data
would be missed because it starts within a character in the converted
form. A violation of the second rule could create false positives in
matching, if two different bytes are mapped to the same character (or
are both unmapped, in which case String would map them to '?').
I am not familiar enough with the range of available character encodings
to know if there's one that fits that description. Do you know if there
is such a character encoding?
In any case, it would require comments to point out the kludgy solution,
as I would presume on seeing such a thing that the author was confused,
and try to fix it.
--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation