Java real-time (9600 baud) stream parsing


I have a stream of data going by and I need to pull out some of the records. The stream is all ASCII.
The stream/record fields are delimited by slash "/".
My particular record is 256 chars and begins by a field of 6 BLANKS followed by a slash "/"
and 30 slashes "/" into the record I have an Identifier of /GH/. I then have 5 more fields delimited by "/", which marks the end of the record. There is other stuff in this stream which is useless and may, coincedentally have the same 30 s;ashes but it wil nothave the /BF/ identifier. Once I have found the target string I have to save the string from the frist 6 BLANKS to the last 5 fields.

Interesting problem....
I have loooked at split, tokenizer, etc and have found those solutions wanting because of the unusual
regex required. For example the following does not work as a recognizer:

1. Pattern p = Pattern.compile("[\\s\\s\\s\\s\\s\\s]/{30}/GH/{5}");

Thank You

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

you cannot match to a stream, you need at least read the stream 'til you identified something you want to match, then you can use a regex against the stored (rad) data not the stream
dennisk1718Author Commented:

Oh, ok...

Sure...I have a continous stream of data running by, and I need to grab some messages form that stream. I have only one chance and then it is gone. 9600bps is not too fast but...
I need a recognizer and a parser. I am stuck a little on the recognizer. I am using socket with readline currently, but it looks like I need to use a StringReader.

Are the Java I/O experts out there????

Thank You
if you need to match something in real time in the stream, I guess you need to write your own parser

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.