Instances of this class take as input io. 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:
buffer1:HELLO\nHOW ARE Y buffer2:OU?\nI AM buffer3: DOING OK buffer4:\nThen the output would be:
buffer1:HELLO buffer2:HOW ARE YOU? buffer3:I AM DOING OKInstances of this class can be changed between delimited mode and fixed size record mode on the fly as individual records are read, this allows you to parse protocols where, for example, the first 5 records might all be fixed size (of potentially different sizes), followed by some delimited records, followed by more fixed size records.
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.
| Modifier and Type | Method and Description |
|---|---|
| public void | delimitedMode(String
the new delimeter delim)Flip the parser into delimited mode, and where the delimiter can be represented
by the String |
| public void | delimitedMode(Buffer
the new delimiter delim)
References Deprecated
Buffer is deprecated or references (maybe indirectly) at least one deprecated element.
Flip the parser into delimited mode, and where the delimiter can be represented
by the delimiter |
| public RecordParser | |
| public RecordParser | |
| public RecordParser | fetch(long amount)
Redeclares io. Fetch the specified |
| public void | fixedSizeMode(int
the new record size size)Flip the parser into fixed size mode, where the record size is specified by |
| public void | handle(Buffer
a chunk of data buffer)Redeclares io.
References Deprecated
Buffer is deprecated or references (maybe indirectly) at least one deprecated element.
This method is called to provide the parser with data. |
| public RecordParser | |
| public RecordParser | Returns: a reference to this, so the API can be used fluentlythe maximum record size size)Set the maximum allowed size for a record when using the delimited mode. |
| public static RecordParser | newDelimited(String
the initial delimiter string delim, Handler<Buffer> handler that will receive the output output)Like |
| public static RecordParser | newDelimited(String
the initial delimiter string delim, ReadStream<Buffer> the wrapped stream stream)Like |
| public static RecordParser | newDelimited(String
the initial delimiter string delim)Create a new |
| public static RecordParser | newDelimited(Buffer
the initial delimiter buffer delim)
References Deprecated
Buffer is deprecated or references (maybe indirectly) at least one deprecated element.
Create a new |
| public static RecordParser | newDelimited(Buffer
the initial delimiter buffer delim, Handler<Buffer> handler that will receive the output output)
References Deprecated
Buffer is deprecated or references (maybe indirectly) at least one deprecated element.
Like |
| public static RecordParser | newDelimited(Buffer
the initial delimiter buffer delim, ReadStream<Buffer> the wrapped stream stream)
References Deprecated
Buffer is deprecated or references (maybe indirectly) at least one deprecated element.
Like |
| public static RecordParser | newFixed(int
the initial record size size)Create a new |
| public static RecordParser | newFixed(int
the initial record size size, Handler<Buffer> handler that will receive the output output)Like |
| public static RecordParser | newFixed(int
the initial record size size, ReadStream<Buffer> the wrapped stream stream)Like |
| public RecordParser | pause()
Redeclares io. Pause the |
| public RecordParser | resume()
Redeclares io. Resume reading, and sets the buffer in |
| public void |
| delimitedMode | back to summary |
|---|---|
| public void delimitedMode(String delim) Flip the parser into delimited mode, and where the delimiter can be represented
by the String This method can be called multiple times with different values of delim while data is being parsed.
| |
| delimitedMode | back to summary |
|---|---|
| public void delimitedMode(Buffer delim)
References Deprecated
See corresponding docs for further information. Flip the parser into delimited mode, and where the delimiter can be represented
by the delimiter This method can be called multiple times with different values of delim while data is being parsed.
| |
| endHandler | back to summary |
|---|---|
public RecordParser endHandler(Handler<Void> endHandler)
| |
| exceptionHandler | back to summary |
|---|---|
public RecordParser exceptionHandler(Handler<Throwable> handler)
| |
| fetch | back to summary |
|---|---|
| public RecordParser fetch(long amount) Redeclares io. Doc from io. Fetch the specified
| |
| fixedSizeMode | back to summary |
|---|---|
| public void fixedSizeMode(int size) Flip the parser into fixed size mode, where the record size is specified by This method can be called multiple times with different values of size while data is being parsed.
| |
| handle | back to summary |
|---|---|
| public void handle(Buffer buffer) Redeclares io. References Deprecated
See corresponding docs for further information. This method is called to provide the parser with data.
| |
| handler | back to summary |
|---|---|
public RecordParser handler(Handler<Buffer> handler)
| |
| maxRecordSize | back to summary |
|---|---|
| public RecordParser maxRecordSize(int size) 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
| |
| newDelimited | back to summary |
|---|---|
| public static RecordParser newDelimited(String delim, Handler<Buffer> output) Like | |
| newDelimited | back to summary |
|---|---|
| public static RecordParser newDelimited(String delim, ReadStream<Buffer> stream) Like
The
| |
| newDelimited | back to summary |
|---|---|
| public static RecordParser newDelimited(String delim) Create a new
| |
| newDelimited | back to summary |
|---|---|
| public static RecordParser newDelimited(Buffer delim)
References Deprecated
See corresponding docs for further information. Create a new
| |
| newDelimited | back to summary |
|---|---|
| public static RecordParser newDelimited(Buffer delim, Handler<Buffer> output)
References Deprecated
See corresponding docs for further information. Like | |
| newDelimited | back to summary |
|---|---|
| public static RecordParser newDelimited(Buffer delim, ReadStream<Buffer> stream)
References Deprecated
See corresponding docs for further information. Like
The
| |
| newFixed | back to summary |
|---|---|
| public static RecordParser newFixed(int size) Create a new
| |
| newFixed | back to summary |
|---|---|
| public static RecordParser newFixed(int size, Handler<Buffer> output) Like | |
| newFixed | back to summary |
|---|---|
| public static RecordParser newFixed(int size, ReadStream<Buffer> stream) Like
The
| |
| pause | back to summary |
|---|---|
| public RecordParser pause() Redeclares io. Doc from io. Pause the
While it's paused, no data will be sent to the data
| |
| resume | back to summary |
|---|---|
| public RecordParser resume() Redeclares io. Doc from io. Resume reading, and sets the buffer in
If the
| |
| setOutput | back to summary |
|---|---|
| public void setOutput(Handler<Buffer> output) | |