Flip the parser into delimited mode, and where the delimiter can be represented
by the String delim
encoded in latin-1 . Don't use this if your String contains other than latin-1 characters.
This method can be called multiple times with different values of delim while data is being parsed.
Flip the parser into delimited mode, and where the delimiter can be represented
by the delimiter delim
.
This method can be called multiple times with different values of delim while data is being parsed.
Flip the parser into fixed size mode, where the record size is specified by size
in bytes.
This method can be called multiple times with different values of size while data is being parsed.
This method is called to provide the parser with data.
Set the maximum allowed size for a record when using the delimited mode. The delimiter itself does not count for the record size.
If a record is longer than specified, an IllegalStateException will be thrown.
Pipe this ReadStream
to the WriteStream
.
Elements emitted by this stream will be written to the write stream until this stream ends or fails.
Once this stream has ended or failed, the write stream will be ended and the handler
will be
called with the result.
Pipe this ReadStream
to the WriteStream
.
Elements emitted by this stream will be written to the write stream until this stream ends or fails.
Once this stream has ended or failed, the write stream will be ended and the handler
will be
called with the result.
Like {@link RecordParser#newDelimited} but set the output
that will receive whole records
which have been parsed.
Like {@link RecordParser#newDelimited} but wraps the stream
. The stream
handlers will be set/unset
when the {@link RecordParser#handler} is set.
pause()
/resume()
operations are propagated to the stream
.
Create a new RecordParser
instance, initially in delimited mode, and where the delimiter can be represented
by the String delim endcoded in latin-1 . Don't use this if your String contains other than latin-1 characters.
output
Will receive whole records which have been parsed.
Create a new RecordParser
instance, initially in delimited mode, and where the delimiter can be represented
by the Buffer
delim.
Like {@link RecordParser#newDelimited} but set the output
that will receive whole records
which have been parsed.
Like {@link RecordParser#newDelimited} but wraps the stream
. The stream
handlers will be set/unset
when the {@link RecordParser#handler} is set.
pause()
/resume()
operations are propagated to the stream
.
Create a new RecordParser
instance, initially in fixed size mode, and where the record size is specified
by the size
parameter.
output
Will receive whole records which have been parsed.
Like {@link RecordParser#newFixed} but set the output
that will receive whole records
which have been parsed.
Like {@link RecordParser#newFixed} but wraps the stream
. The stream
handlers will be set/unset
when the {@link RecordParser#handler} is set.
pause()
/resume()
operations are propagated to the stream
.
Generated using TypeDoc
A helper class which allows you to easily parse protocols which are delimited by a sequence of bytes, or fixed size records.
Instances of this class take as input Buffer instances containing raw bytes, and output records.
For example, if I had a simple ASCII text protocol delimited by '\n' and the input was the following:
Instances of this class can't currently be used for protocols where the text is encoded with something other than a 1-1 byte-char mapping.
Please see the documentation for more information.