Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Byte Parsing

kramJul 30 2008 — edited Aug 1 2008
I hope this is the correct place for this question, so sorry if its not...

I have a performance centric application which requires some parsing of a custom protocol, we are storing our data in byte[] arrays, and I am required to parse the array (which I know will be string data) and return a value found in the string.

The way Im thinking of doing it is like this:
return 
    new String(
        this.messageBytes()
    ).substring( *someindex* , 6);
I want to make it as memort efficient as possible, and fast!

what I need to know is:
Is this a good way of doing it?

Also, notice the someindex; I need to calculate the position of the text "AAP" (like string.indexOf("AAP"))

Should I just create a temp string then parse it?

Thanks a lot!
Mark
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 29 2008
Added on Jul 30 2008
19 comments
345 views