Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Applying a regular expression to a Java I/O Stream [closed]

I seek an example of applying a regular expression to a Java I/O stream that doesn't simply convert the stream to a string as I would like to preserve binary data. Most of the examples on the Internet focus on text data...

like image 932
McGovernTheory Avatar asked Apr 04 '09 11:04

McGovernTheory


1 Answers

The needed functionality is not present on Java Standard. You will have to use jakarta regexp, and specifically, the StreamCharacterIterator class. This class encapsulates a InputStream for use in regexp operations.

If you want to use the standard regular expression package, I would suggest take a the source from the previous class here and change the contract by implementing CharSequence instead of CharacterIterator.

like image 155
HMM Avatar answered Nov 15 '22 03:11

HMM