Interface ByteStreamCharMatcher

  • All Known Implementing Classes:
    MultiByteCharMatcher

    public interface ByteStreamCharMatcher
    ByteStreamCharMatcher are state machines used to look for char sequences within a stream of bytes. Bytes from the stream are added one a time and converted to character stream which are in turn fed into a char stream recognizer. As each byte is added, an indication is returned if that byte caused a terminated sequence to be found. A sequence is simply a pair of indexes indicated the start and end indexes into the byte stream where the char sequence started and ended respectively along with an indication that the sequence was null terminated.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      boolean add​(byte b)
      Adds the next contiguous byte to this matcher
      boolean endSequence()
      Tells the matcher that there are no more contiguous bytes.
      Sequence getSequence()
      Returns the currently recognized sequence which only exists immediately after an add or end sequence is called with a return value of true.
      void reset()
      Resets the internal state of this ByteMatcher so that it can be reused against another byte stream.
    • Method Detail

      • add

        boolean add​(byte b)
        Adds the next contiguous byte to this matcher
        Parameters:
        b - the next contiguous byte in the search stream.
        Returns:
        true if the given byte triggered a sequence match. Note that this byte may not be a part of the recognized sequence.
      • endSequence

        boolean endSequence()
        Tells the matcher that there are no more contiguous bytes. If the current state of the matcher is such that there is a valid sequence that can be at the end of the stream, then a sequence will be created and true will be returned.
        Returns:
        true if there is a valid sequence at the end of the stream.
      • getSequence

        Sequence getSequence()
        Returns the currently recognized sequence which only exists immediately after an add or end sequence is called with a return value of true.
        Returns:
      • reset

        void reset()
        Resets the internal state of this ByteMatcher so that it can be reused against another byte stream.