3

First, I need to read a binary String from file into memory - how ? To read I tried nio.CharBuffer, and then byte[]. But later I need to get a binary String with all possible binary data to do regular expression on, so it was not a success.

Then, I need to extract binary sequences from this binary string and save them in each separate binary file. Regular expr is something like this "some_string \0{4} \2.+?\0{10}", some_string followed by a space, then the \2 byte, then binary data and then 10 NULL bytes.

What would you recommend?

1 Answer 1

1

I'm not sure your using the right tool here, however,

  • make sure you are using a 1-byte encoding such as ISO-8859-1 to convert between String and byte[],
  • note that a '.' in a regexp excludes the end of line character, so you may want to use [\0..\255] instead
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.