I am parsing input from a stream from a 3rd party piece of hardware. The thing prints messages out meant for a human. It includes keywords and other characters I don't care about. I want to take a stream and find the next occurrence of one of these keywords with regex. Then I can do a switch statement and figure out what command was sent.
I cannot use the Scanner class because reading is blocked and I cannot interrupt it to stop the thread. I cannot close the stream either as a work around.
Are there any libraries I could use to do what I am looking to do here? I found Streamflyer, but that seems to be overkill and maybe not what I am looking for. It also suggested FilterInputStream, and FilterReader, but I don't think those are what I am looking for.
BufferedReaderand callreadLine(), then run the regex on the line.