vertx-lang-scala-docs_2.12 3.6.0 API < Back
 

# Packages

-  package root
  Definition Classes
    root
-  package io
  Definition Classes
    root
-  package vertx
  Definition Classes
    io
-  package scala
  Definition Classes
    vertx
-  package core
  Definition Classes
    scala
-  package parsetools
  Definition Classes
    core
- JsonEvent
- JsonParser
- RecordParser

c

io.vertx.scala.core.parsetools

# RecordParser 

###
Companion object RecordParser

#### class RecordParser extends ReadStream[Buffer] with 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:\n

Then the output would be:

    buffer1:HELLO
    buffer2:HOW ARE YOU?
    buffer3:I AM DOING OK

Instances 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.

Linear Supertypes
Handler[Buffer], ReadStream[Buffer], StreamBase, AnyRef, Any
 
Ordering

1. Alphabetic
2. By Inheritance

Inherited

1. RecordParser
2. Handler
3. ReadStream
4. StreamBase
5. AnyRef
6. Any

1. Hide All
2. Show All

Visibility

1. Public
2. All

### Instance Constructors

1.  new RecordParser(_asJava: AnyRef)

### Value Members

1.  final def !=(arg0: Any): Boolean
   Definition Classes
     AnyRef → Any
2.  final def ##(): Int
   Definition Classes
     AnyRef → Any
3.  final def ==(arg0: Any): Boolean
   Definition Classes
     AnyRef → Any
4.  final def asInstanceOf[T0]: T0
   Definition Classes
     Any
5.  def asJava: AnyRef
   Definition Classes
     RecordParser → ReadStream → StreamBase
6.  def clone(): AnyRef
   Attributes
     protected[java.lang]
   Definition Classes
     AnyRef
   Annotations
     @native() @throws( ... )
7.  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. * @param delim the new delimiter

8.  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. * @param delim the new delimeter

9.  def endHandler(endHandler: Handler[Unit]): RecordParser

   Set an end handler.

   Set an end handler. Once the stream has ended, and there is no more data to be read, this handler will be called. * @return a reference to this, so the API can be used fluently

   Definition Classes
     RecordParser → ReadStream
10.  final def eq(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef
11.  def equals(arg0: Any): Boolean
    Definition Classes
      AnyRef → Any
12.  def exceptionHandler(handler: Handler[Throwable]): RecordParser

    Set an exception handler on the read stream.

    Set an exception handler on the read stream. * @param handler the exception handler

    returns

      a reference to this, so the API can be used fluently

    Definition Classes
      RecordParser → ReadStream → StreamBase
13.  def fetch(amount: Long): RecordParser

    Fetch the specified `amount` of elements.

    Fetch the specified `amount` of elements. If the `ReadStream` has been paused, reading will recommence with the specified `amount` of items, otherwise the specified `amount` will be added to the current stream demand. * @return a reference to this, so the API can be used fluently

    Definition Classes
      RecordParser → ReadStream
14.  def finalize(): Unit
    Attributes
      protected[java.lang]
    Definition Classes
      AnyRef
    Annotations
      @throws( classOf[java.lang.Throwable] )
15.  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. * @param size the new record size

16.  final def getClass(): Class[_]
    Definition Classes
      AnyRef → Any
    Annotations
      @native()
17.  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. * @param buffer a chunk of data

    Definition Classes
      RecordParser → Handler
18.  def handler(handler: Handler[Buffer]): RecordParser

    Set a data handler.

    Set a data handler. As data is read, the handler will be called with the data. * @return a reference to this, so the API can be used fluently

    Definition Classes
      RecordParser → ReadStream
19.  def hashCode(): Int
    Definition Classes
      AnyRef → Any
    Annotations
      @native()
20.  final def isInstanceOf[T0]: Boolean
    Definition Classes
      Any
21.  def maxRecordSize(size: Int): RecordParser

    Set the maximum allowed size for a record when using the delimited mode.

    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. * @param size the maximum record size

    returns

      a reference to this, so the API can be used fluently

22.  final def ne(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef
23.  final def notify(): Unit
    Definition Classes
      AnyRef
    Annotations
      @native()
24.  final def notifyAll(): Unit
    Definition Classes
      AnyRef
    Annotations
      @native()
25.  def pause(): RecordParser

    Pause the `ReadStream`, it sets the buffer in `fetch` mode and clears the actual demand.

    Pause the `ReadStream`, it sets the buffer in `fetch` mode and clears the actual demand.

    While it's paused, no data will be sent to the data `handler`. * @return a reference to this, so the API can be used fluently

    Definition Classes
      RecordParser → ReadStream
26.  def resume(): RecordParser

    Resume reading, and sets the buffer in `flowing` mode.

    Resume reading, and sets the buffer in `flowing` mode.

    If the `ReadStream` has been paused, reading will recommence on it. * @return a reference to this, so the API can be used fluently

    Definition Classes
      RecordParser → ReadStream
27.  def setOutput(output: Handler[Buffer]): Unit
28.  final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
      AnyRef
29.  def toString(): String
    Definition Classes
      AnyRef → Any
30.  final def wait(): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws( ... )
31.  final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws( ... )
32.  final def wait(arg0: Long): Unit
    Definition Classes
      AnyRef
    Annotations
      @native() @throws( ... )

### Inherited from Handler[Buffer]

### Inherited from ReadStream[Buffer]

### Inherited from StreamBase

### Inherited from AnyRef

### Inherited from Any

### Ungrouped