class RecordParser extends Handler[Buffer]
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 io.vertx.scala.core.buffer.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:
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.
- Alphabetic
- By Inheritance
- RecordParser
- Handler
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new RecordParser(_asJava: AnyRef)
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
- def asJava: AnyRef
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
delimitedMode(delim: Buffer): Unit
Flip the parser into delimited mode, and where the delimiter can be represented by the delimiter
delim
.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.
- delim
the new delimiter
-
def
delimitedMode(delim: String): Unit
Flip the parser into delimited mode, and where the delimiter can be represented by the String
delim
encoded in latin-1 .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.
- delim
the new delimeter
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
fixedSizeMode(size: Int): Unit
Flip the parser into fixed size mode, where the record size is specified by
size
in bytes.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.
- size
the new record size
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
handle(buffer: Buffer): Unit
This method is called to provide the parser with data.
This method is called to provide the parser with data.
- buffer
a chunk of data
- Definition Classes
- RecordParser → Handler
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- def setOutput(output: Handler[Buffer]): Unit
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )