public class RecordParserImpl extends Object implements RecordParser
Modifier and Type | Method and Description |
---|---|
void |
delimitedMode(Buffer delim)
Flip the parser into delimited mode, and where the delimiter can be represented
by the delimiter
delim . |
void |
delimitedMode(String delim)
Flip the parser into delimited mode, and where the delimiter can be represented
by the String
delim encoded in latin-1 . |
void |
fixedSizeMode(int size)
Flip the parser into fixed size mode, where the record size is specified by
size in bytes. |
void |
handle(Buffer buffer)
This method is called to provide the parser with data.
|
static Buffer |
latin1StringToBytes(String str)
Helper method to convert a latin-1 String to an array of bytes for use as a delimiter
Please do not use this for non latin-1 characters
|
static RecordParser |
newDelimited(Buffer delim,
Handler<Buffer> output)
Create a new
RecordParser instance, initially in delimited mode, and where the delimiter can be represented
by the buffer delim. |
static RecordParser |
newDelimited(String delim,
Handler<Buffer> output)
Create a new
RecordParser instance, initially in delimited mode, and where the delimiter can be represented
by the String delim endcoded in latin-1 . |
static RecordParser |
newFixed(int size,
Handler<Buffer> output)
Create a new
RecordParser instance, initially in fixed size mode, and where the record size is specified
by the size parameter. |
void |
setOutput(Handler<Buffer> output) |
public void setOutput(Handler<Buffer> output)
setOutput
in interface RecordParser
public static Buffer latin1StringToBytes(String str)
str
- the stringpublic static RecordParser newDelimited(String delim, Handler<Buffer> output)
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.
newDelimited
in interface RecordParser
delim
- the initial delimiter stringoutput
- handler that will receive the outputpublic static RecordParser newDelimited(Buffer delim, Handler<Buffer> output)
RecordParser
instance, initially in delimited mode, and where the delimiter can be represented
by the buffer
delim.
output
Will receive whole records which have been parsed.
newDelimited
in interface RecordParser
delim
- the initial delimiter bufferoutput
- handler that will receive the outputpublic static RecordParser newFixed(int size, Handler<Buffer> output)
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.
newFixed
in interface RecordParser
size
- the initial record sizeoutput
- handler that will receive the outputpublic void delimitedMode(String delim)
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.
delimitedMode
in interface RecordParser
delim
- the new delimeterpublic void delimitedMode(Buffer delim)
delim
.
This method can be called multiple times with different values of delim while data is being parsed.
delimitedMode
in interface RecordParser
delim
- the new delimiterpublic void fixedSizeMode(int size)
size
in bytes.
This method can be called multiple times with different values of size while data is being parsed.
fixedSizeMode
in interface RecordParser
size
- the new record sizeCopyright © 2015. All Rights Reserved.