Module id.ICE

Class DelimiterMessageScanner

Object
DelimiterMessageScanner
All Implemented Interfaces:
MessageScanner
Direct Known Subclasses:
NewLineMessageScanner

public class DelimiterMessageScanner extends Object implements MessageScanner
Scanner for messages where each message is represented as a single line ending with some delimiter char (ex. ';').

The delimiter is not considered as part of the message.

  • Constructor Details

    • DelimiterMessageScanner

      public DelimiterMessageScanner(byte delim)
      Parameters:
      delim - delimiter character (for UTF-8 characters use conversion for example for ';' use (byte)';')
  • Method Details

    • scan

      public int scan(ByteBuffer buf)
      Specified by:
      scan in interface MessageScanner
      Returns:
      message end position or -1 if message is not complete or not found in the buffer yet. If last byte of the message found on position n then the message end position will be considered as n + 1.