== Record Parser

The record parser allows you to easily parse protocols which are delimited by a sequence of bytes, or fixed
size records.

It transforms a sequence of input buffer to a sequence of buffer structured as configured (either
fixed size or separated records).

For example, if you have a simple ASCII text protocol delimited by '\n' and the input is the following:

[source]
----
buffer1:HELLO\nHOW ARE Y
buffer2:OU?\nI AM
buffer3: DOING OK
buffer4:\n
----

The record parser would produce
[source]
----
buffer1:HELLO
buffer2:HOW ARE YOU?
buffer3:I AM DOING OK
----

Let's see the associated code:

[source, ceylon]
----
import io.vertx.ceylon.core.buffer { buffer } 
import io.vertx.ceylon.core.parsetools { recordParser } 

...

value parser = recordParser.newDelimited("\n", (Buffer h) {
  print(h.toString());
});

parser.handle(buffer.buffer("HELLO\nHOW ARE Y"));
parser.handle(buffer.buffer("OU?\nI AM"));
parser.handle(buffer.buffer("DOING OK"));
parser.handle(buffer.buffer("\n"));

----

You can also produce fixed sized chunks as follows:

[source, ceylon]
----
import io.vertx.ceylon.core.parsetools { recordParser } 

...

recordParser.newFixed(4, (Buffer h) {
  print(h.toString());
});

----

For more details, check out the `link:../../ceylondoc/vertx-core//parsetools/RecordParser.type.html[RecordParser]` class.