/*
 * Copyright 2014 Red Hat, Inc.
 *
 * Red Hat licenses this file to you under the Apache License, version 2.0
 * (the "License"); you may not use this file except in compliance with the
 * License.  You may obtain a copy of the License at:
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */

package io.vertx.reactivex.core.parsetools;

import java.util.Map;
import io.reactivex.Observable;
import io.reactivex.Flowable;
import io.reactivex.Single;
import io.reactivex.Completable;
import io.reactivex.Maybe;
import io.vertx.core.AsyncResult;
import io.vertx.core.Handler;

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

NOTE: This class has been automatically generated from the original non RX-ified interface using Vert.x codegen.
/** * A helper class which allows you to easily parse protocols which are delimited by a sequence of bytes, or fixed * size records. * <p> * Instances of this class take as input {@link io.vertx.reactivex.core.buffer.Buffer} instances containing raw bytes, * and output records. * <p> * For example, if I had a simple ASCII text protocol delimited by '\n' and the input was the following: * <p> * <pre> * buffer1:HELLO\nHOW ARE Y * buffer2:OU?\nI AM * buffer3: DOING OK * buffer4:\n * </pre> * Then the output would be:<p> * <pre> * buffer1:HELLO * buffer2:HOW ARE YOU? * buffer3:I AM DOING OK * </pre> * 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. * <p> * 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. * <p> * Please see the documentation for more information. * * <p/> * NOTE: This class has been automatically generated from the {@link io.vertx.core.parsetools.RecordParser original} non RX-ified interface using Vert.x codegen. */
@io.vertx.lang.rx.RxGen(io.vertx.core.parsetools.RecordParser.class) public class RecordParser implements io.vertx.reactivex.core.streams.ReadStream<io.vertx.reactivex.core.buffer.Buffer>, io.vertx.core.Handler<io.vertx.reactivex.core.buffer.Buffer> { @Override public String toString() { return delegate.toString(); } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; RecordParser that = (RecordParser) o; return delegate.equals(that.delegate); } @Override public int hashCode() { return delegate.hashCode(); } public static final io.vertx.lang.rx.TypeArg<RecordParser> __TYPE_ARG = new io.vertx.lang.rx.TypeArg<>( obj -> new RecordParser((io.vertx.core.parsetools.RecordParser) obj), RecordParser::getDelegate ); private final io.vertx.core.parsetools.RecordParser delegate; public RecordParser(io.vertx.core.parsetools.RecordParser delegate) { this.delegate = delegate; } public io.vertx.core.parsetools.RecordParser getDelegate() { return delegate; } private io.reactivex.Observable<io.vertx.reactivex.core.buffer.Buffer> observable; private io.reactivex.Flowable<io.vertx.reactivex.core.buffer.Buffer> flowable; public synchronized io.reactivex.Observable<io.vertx.reactivex.core.buffer.Buffer> toObservable() { if (observable == null) { java.util.function.Function<io.vertx.core.buffer.Buffer, io.vertx.reactivex.core.buffer.Buffer> conv = io.vertx.reactivex.core.buffer.Buffer::newInstance; observable = io.vertx.reactivex.ObservableHelper.toObservable(delegate, conv); } return observable; } public synchronized io.reactivex.Flowable<io.vertx.reactivex.core.buffer.Buffer> toFlowable() { if (flowable == null) { java.util.function.Function<io.vertx.core.buffer.Buffer, io.vertx.reactivex.core.buffer.Buffer> conv = io.vertx.reactivex.core.buffer.Buffer::newInstance; flowable = io.vertx.reactivex.FlowableHelper.toFlowable(delegate, conv); } return flowable; }
Pause this stream and return a to transfer the elements of this stream to a destination .

The stream will be resumed when the pipe will be wired to a WriteStream.
Returns:a pipe
/** * Pause this stream and return a to transfer the elements of this stream to a destination . * <p/> * The stream will be resumed when the pipe will be wired to a <code>WriteStream</code>. * @return a pipe */
public io.vertx.reactivex.core.streams.Pipe<io.vertx.reactivex.core.buffer.Buffer> pipe() { io.vertx.reactivex.core.streams.Pipe<io.vertx.reactivex.core.buffer.Buffer> ret = io.vertx.reactivex.core.streams.Pipe.newInstance(delegate.pipe(), (io.vertx.lang.rx.TypeArg)io.vertx.reactivex.core.buffer.Buffer.__TYPE_ARG); return ret; }
Like ReadStream.pipeTo but with no completion handler.
Params:
  • dst –
/** * Like {@link io.vertx.reactivex.core.streams.ReadStream#pipeTo} but with no completion handler. * @param dst */
public void pipeTo(io.vertx.reactivex.core.streams.WriteStream<io.vertx.reactivex.core.buffer.Buffer> dst) { delegate.pipeTo(dst.getDelegate()); }
Pipe this ReadStream to the WriteStream.

Elements emitted by this stream will be written to the write stream until this stream ends or fails.

Once this stream has ended or failed, the write stream will be ended and the handler will be called with the result.

Params:
  • dst – the destination write stream
  • handler –
/** * Pipe this <code>ReadStream</code> to the <code>WriteStream</code>. * <p> * Elements emitted by this stream will be written to the write stream until this stream ends or fails. * <p> * Once this stream has ended or failed, the write stream will be ended and the <code>handler</code> will be * called with the result. * @param dst the destination write stream * @param handler */
public void pipeTo(io.vertx.reactivex.core.streams.WriteStream<io.vertx.reactivex.core.buffer.Buffer> dst, Handler<AsyncResult<Void>> handler) { delegate.pipeTo(dst.getDelegate(), handler); }
Pipe this ReadStream to the WriteStream.

Elements emitted by this stream will be written to the write stream until this stream ends or fails.

Once this stream has ended or failed, the write stream will be ended and the handler will be called with the result.

Params:
  • dst – the destination write stream
Returns:
/** * Pipe this <code>ReadStream</code> to the <code>WriteStream</code>. * <p> * Elements emitted by this stream will be written to the write stream until this stream ends or fails. * <p> * Once this stream has ended or failed, the write stream will be ended and the <code>handler</code> will be * called with the result. * @param dst the destination write stream * @return */
public Completable rxPipeTo(io.vertx.reactivex.core.streams.WriteStream<io.vertx.reactivex.core.buffer.Buffer> dst) { return io.vertx.reactivex.impl.AsyncResultCompletable.toCompletable(handler -> { pipeTo(dst, handler); }); } public void setOutput(Handler<io.vertx.reactivex.core.buffer.Buffer> output) { delegate.setOutput(new Handler<io.vertx.core.buffer.Buffer>() { public void handle(io.vertx.core.buffer.Buffer event) { output.handle(io.vertx.reactivex.core.buffer.Buffer.newInstance(event)); } }); }
Like newDelimited but set the output that will receive whole records which have been parsed.
Params:
  • delim – the initial delimiter string
  • output – handler that will receive the output
Returns:
/** * Like {@link io.vertx.reactivex.core.parsetools.RecordParser#newDelimited} but set the <code>output</code> that will receive whole records * which have been parsed. * @param delim the initial delimiter string * @param output handler that will receive the output * @return */
public static io.vertx.reactivex.core.parsetools.RecordParser newDelimited(String delim, Handler<io.vertx.reactivex.core.buffer.Buffer> output) { io.vertx.reactivex.core.parsetools.RecordParser ret = io.vertx.reactivex.core.parsetools.RecordParser.newInstance(io.vertx.core.parsetools.RecordParser.newDelimited(delim, new Handler<io.vertx.core.buffer.Buffer>() { public void handle(io.vertx.core.buffer.Buffer event) { output.handle(io.vertx.reactivex.core.buffer.Buffer.newInstance(event)); } })); return ret; }
Like newDelimited but wraps the stream. The stream handlers will be set/unset when the handler is set.

The pause()/resume() operations are propagated to the stream.
Params:
  • delim – the initial delimiter string
  • stream – the wrapped stream
Returns:
/** * Like {@link io.vertx.reactivex.core.parsetools.RecordParser#newDelimited} but wraps the <code>stream</code>. The <code>stream</code> handlers will be set/unset * when the {@link io.vertx.reactivex.core.parsetools.RecordParser#handler} is set. * <p/> * The <code>pause()</code>/<code>resume()</code> operations are propagated to the <code>stream</code>. * @param delim the initial delimiter string * @param stream the wrapped stream * @return */
public static io.vertx.reactivex.core.parsetools.RecordParser newDelimited(String delim, io.vertx.reactivex.core.streams.ReadStream<io.vertx.reactivex.core.buffer.Buffer> stream) { io.vertx.reactivex.core.parsetools.RecordParser ret = io.vertx.reactivex.core.parsetools.RecordParser.newInstance(io.vertx.core.parsetools.RecordParser.newDelimited(delim, stream.getDelegate())); return ret; }
Like newDelimited but wraps the stream. The stream handlers will be set/unset when the handler is set.

The pause()/resume() operations are propagated to the stream.
Params:
  • delim – the initial delimiter string
  • stream – the wrapped stream
Returns:
/** * Like {@link io.vertx.reactivex.core.parsetools.RecordParser#newDelimited} but wraps the <code>stream</code>. The <code>stream</code> handlers will be set/unset * when the {@link io.vertx.reactivex.core.parsetools.RecordParser#handler} is set. * <p/> * The <code>pause()</code>/<code>resume()</code> operations are propagated to the <code>stream</code>. * @param delim the initial delimiter string * @param stream the wrapped stream * @return */
public static io.vertx.reactivex.core.parsetools.RecordParser newDelimited(String delim, Flowable<io.vertx.reactivex.core.buffer.Buffer> stream) { io.vertx.reactivex.core.parsetools.RecordParser ret = io.vertx.reactivex.core.parsetools.RecordParser.newInstance(io.vertx.core.parsetools.RecordParser.newDelimited(delim, io.vertx.reactivex.impl.ReadStreamSubscriber.asReadStream(stream,obj -> (io.vertx.core.buffer.Buffer)obj.getDelegate()).resume())); return ret; }
Like newDelimited but wraps the stream. The stream handlers will be set/unset when the handler is set.

The pause()/resume() operations are propagated to the stream.
Params:
  • delim – the initial delimiter string
  • stream – the wrapped stream
Returns:
/** * Like {@link io.vertx.reactivex.core.parsetools.RecordParser#newDelimited} but wraps the <code>stream</code>. The <code>stream</code> handlers will be set/unset * when the {@link io.vertx.reactivex.core.parsetools.RecordParser#handler} is set. * <p/> * The <code>pause()</code>/<code>resume()</code> operations are propagated to the <code>stream</code>. * @param delim the initial delimiter string * @param stream the wrapped stream * @return */
public static io.vertx.reactivex.core.parsetools.RecordParser newDelimited(String delim, Observable<io.vertx.reactivex.core.buffer.Buffer> stream) { io.vertx.reactivex.core.parsetools.RecordParser ret = io.vertx.reactivex.core.parsetools.RecordParser.newInstance(io.vertx.core.parsetools.RecordParser.newDelimited(delim, io.vertx.reactivex.impl.ReadStreamSubscriber.asReadStream(stream,obj -> (io.vertx.core.buffer.Buffer)obj.getDelegate()).resume())); return ret; }
Create a new 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.

Params:
  • delim – the initial delimiter string
Returns:
/** * Create a new <code>RecordParser</code> instance, initially in delimited mode, and where the delimiter can be represented * by the String <code></code> delim endcoded in latin-1 . Don't use this if your String contains other than latin-1 characters. * <p> * <code>output</code> Will receive whole records which have been parsed. * @param delim the initial delimiter string * @return */
public static io.vertx.reactivex.core.parsetools.RecordParser newDelimited(String delim) { io.vertx.reactivex.core.parsetools.RecordParser ret = io.vertx.reactivex.core.parsetools.RecordParser.newInstance(io.vertx.core.parsetools.RecordParser.newDelimited(delim)); return ret; }
Create a new RecordParser instance, initially in delimited mode, and where the delimiter can be represented by the Buffer delim.

Params:
  • delim – the initial delimiter buffer
Returns:
/** * Create a new <code>RecordParser</code> instance, initially in delimited mode, and where the delimiter can be represented * by the <code>Buffer</code> delim. * <p> * @param delim the initial delimiter buffer * @return */
public static io.vertx.reactivex.core.parsetools.RecordParser newDelimited(io.vertx.reactivex.core.buffer.Buffer delim) { io.vertx.reactivex.core.parsetools.RecordParser ret = io.vertx.reactivex.core.parsetools.RecordParser.newInstance(io.vertx.core.parsetools.RecordParser.newDelimited(delim.getDelegate())); return ret; }
Like newDelimited but set the output that will receive whole records which have been parsed.
Params:
  • delim – the initial delimiter buffer
  • output – handler that will receive the output
Returns:
/** * Like {@link io.vertx.reactivex.core.parsetools.RecordParser#newDelimited} but set the <code>output</code> that will receive whole records * which have been parsed. * @param delim the initial delimiter buffer * @param output handler that will receive the output * @return */
public static io.vertx.reactivex.core.parsetools.RecordParser newDelimited(io.vertx.reactivex.core.buffer.Buffer delim, Handler<io.vertx.reactivex.core.buffer.Buffer> output) { io.vertx.reactivex.core.parsetools.RecordParser ret = io.vertx.reactivex.core.parsetools.RecordParser.newInstance(io.vertx.core.parsetools.RecordParser.newDelimited(delim.getDelegate(), new Handler<io.vertx.core.buffer.Buffer>() { public void handle(io.vertx.core.buffer.Buffer event) { output.handle(io.vertx.reactivex.core.buffer.Buffer.newInstance(event)); } })); return ret; }
Like newDelimited but wraps the stream. The stream handlers will be set/unset when the handler is set.

The pause()/resume() operations are propagated to the stream.
Params:
  • delim – the initial delimiter buffer
  • stream – the wrapped stream
Returns:
/** * Like {@link io.vertx.reactivex.core.parsetools.RecordParser#newDelimited} but wraps the <code>stream</code>. The <code>stream</code> handlers will be set/unset * when the {@link io.vertx.reactivex.core.parsetools.RecordParser#handler} is set. * <p/> * The <code>pause()</code>/<code>resume()</code> operations are propagated to the <code>stream</code>. * @param delim the initial delimiter buffer * @param stream the wrapped stream * @return */
public static io.vertx.reactivex.core.parsetools.RecordParser newDelimited(io.vertx.reactivex.core.buffer.Buffer delim, io.vertx.reactivex.core.streams.ReadStream<io.vertx.reactivex.core.buffer.Buffer> stream) { io.vertx.reactivex.core.parsetools.RecordParser ret = io.vertx.reactivex.core.parsetools.RecordParser.newInstance(io.vertx.core.parsetools.RecordParser.newDelimited(delim.getDelegate(), stream.getDelegate())); return ret; }
Like newDelimited but wraps the stream. The stream handlers will be set/unset when the handler is set.

The pause()/resume() operations are propagated to the stream.
Params:
  • delim – the initial delimiter buffer
  • stream – the wrapped stream
Returns:
/** * Like {@link io.vertx.reactivex.core.parsetools.RecordParser#newDelimited} but wraps the <code>stream</code>. The <code>stream</code> handlers will be set/unset * when the {@link io.vertx.reactivex.core.parsetools.RecordParser#handler} is set. * <p/> * The <code>pause()</code>/<code>resume()</code> operations are propagated to the <code>stream</code>. * @param delim the initial delimiter buffer * @param stream the wrapped stream * @return */
public static io.vertx.reactivex.core.parsetools.RecordParser newDelimited(io.vertx.reactivex.core.buffer.Buffer delim, Flowable<io.vertx.reactivex.core.buffer.Buffer> stream) { io.vertx.reactivex.core.parsetools.RecordParser ret = io.vertx.reactivex.core.parsetools.RecordParser.newInstance(io.vertx.core.parsetools.RecordParser.newDelimited(delim.getDelegate(), io.vertx.reactivex.impl.ReadStreamSubscriber.asReadStream(stream,obj -> (io.vertx.core.buffer.Buffer)obj.getDelegate()).resume())); return ret; }
Like newDelimited but wraps the stream. The stream handlers will be set/unset when the handler is set.

The pause()/resume() operations are propagated to the stream.
Params:
  • delim – the initial delimiter buffer
  • stream – the wrapped stream
Returns:
/** * Like {@link io.vertx.reactivex.core.parsetools.RecordParser#newDelimited} but wraps the <code>stream</code>. The <code>stream</code> handlers will be set/unset * when the {@link io.vertx.reactivex.core.parsetools.RecordParser#handler} is set. * <p/> * The <code>pause()</code>/<code>resume()</code> operations are propagated to the <code>stream</code>. * @param delim the initial delimiter buffer * @param stream the wrapped stream * @return */
public static io.vertx.reactivex.core.parsetools.RecordParser newDelimited(io.vertx.reactivex.core.buffer.Buffer delim, Observable<io.vertx.reactivex.core.buffer.Buffer> stream) { io.vertx.reactivex.core.parsetools.RecordParser ret = io.vertx.reactivex.core.parsetools.RecordParser.newInstance(io.vertx.core.parsetools.RecordParser.newDelimited(delim.getDelegate(), io.vertx.reactivex.impl.ReadStreamSubscriber.asReadStream(stream,obj -> (io.vertx.core.buffer.Buffer)obj.getDelegate()).resume())); return ret; }
Create a new 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.

Params:
  • size – the initial record size
Returns:
/** * Create a new <code>RecordParser</code> instance, initially in fixed size mode, and where the record size is specified * by the <code>size</code> parameter. * <p> * <code>output</code> Will receive whole records which have been parsed. * @param size the initial record size * @return */
public static io.vertx.reactivex.core.parsetools.RecordParser newFixed(int size) { io.vertx.reactivex.core.parsetools.RecordParser ret = io.vertx.reactivex.core.parsetools.RecordParser.newInstance(io.vertx.core.parsetools.RecordParser.newFixed(size)); return ret; }
Like newFixed but set the output that will receive whole records which have been parsed.
Params:
  • size – the initial record size
  • output – handler that will receive the output
Returns:
/** * Like {@link io.vertx.reactivex.core.parsetools.RecordParser#newFixed} but set the <code>output</code> that will receive whole records * which have been parsed. * @param size the initial record size * @param output handler that will receive the output * @return */
public static io.vertx.reactivex.core.parsetools.RecordParser newFixed(int size, Handler<io.vertx.reactivex.core.buffer.Buffer> output) { io.vertx.reactivex.core.parsetools.RecordParser ret = io.vertx.reactivex.core.parsetools.RecordParser.newInstance(io.vertx.core.parsetools.RecordParser.newFixed(size, new Handler<io.vertx.core.buffer.Buffer>() { public void handle(io.vertx.core.buffer.Buffer event) { output.handle(io.vertx.reactivex.core.buffer.Buffer.newInstance(event)); } })); return ret; }
Like newFixed but wraps the stream. The stream handlers will be set/unset when the handler is set.

The pause()/resume() operations are propagated to the stream.
Params:
  • size – the initial record size
  • stream – the wrapped stream
Returns:
/** * Like {@link io.vertx.reactivex.core.parsetools.RecordParser#newFixed} but wraps the <code>stream</code>. The <code>stream</code> handlers will be set/unset * when the {@link io.vertx.reactivex.core.parsetools.RecordParser#handler} is set. * <p/> * The <code>pause()</code>/<code>resume()</code> operations are propagated to the <code>stream</code>. * @param size the initial record size * @param stream the wrapped stream * @return */
public static io.vertx.reactivex.core.parsetools.RecordParser newFixed(int size, io.vertx.reactivex.core.streams.ReadStream<io.vertx.reactivex.core.buffer.Buffer> stream) { io.vertx.reactivex.core.parsetools.RecordParser ret = io.vertx.reactivex.core.parsetools.RecordParser.newInstance(io.vertx.core.parsetools.RecordParser.newFixed(size, stream.getDelegate())); return ret; }
Like newFixed but wraps the stream. The stream handlers will be set/unset when the handler is set.

The pause()/resume() operations are propagated to the stream.
Params:
  • size – the initial record size
  • stream – the wrapped stream
Returns:
/** * Like {@link io.vertx.reactivex.core.parsetools.RecordParser#newFixed} but wraps the <code>stream</code>. The <code>stream</code> handlers will be set/unset * when the {@link io.vertx.reactivex.core.parsetools.RecordParser#handler} is set. * <p/> * The <code>pause()</code>/<code>resume()</code> operations are propagated to the <code>stream</code>. * @param size the initial record size * @param stream the wrapped stream * @return */
public static io.vertx.reactivex.core.parsetools.RecordParser newFixed(int size, Flowable<io.vertx.reactivex.core.buffer.Buffer> stream) { io.vertx.reactivex.core.parsetools.RecordParser ret = io.vertx.reactivex.core.parsetools.RecordParser.newInstance(io.vertx.core.parsetools.RecordParser.newFixed(size, io.vertx.reactivex.impl.ReadStreamSubscriber.asReadStream(stream,obj -> (io.vertx.core.buffer.Buffer)obj.getDelegate()).resume())); return ret; }
Like newFixed but wraps the stream. The stream handlers will be set/unset when the handler is set.

The pause()/resume() operations are propagated to the stream.
Params:
  • size – the initial record size
  • stream – the wrapped stream
Returns:
/** * Like {@link io.vertx.reactivex.core.parsetools.RecordParser#newFixed} but wraps the <code>stream</code>. The <code>stream</code> handlers will be set/unset * when the {@link io.vertx.reactivex.core.parsetools.RecordParser#handler} is set. * <p/> * The <code>pause()</code>/<code>resume()</code> operations are propagated to the <code>stream</code>. * @param size the initial record size * @param stream the wrapped stream * @return */
public static io.vertx.reactivex.core.parsetools.RecordParser newFixed(int size, Observable<io.vertx.reactivex.core.buffer.Buffer> stream) { io.vertx.reactivex.core.parsetools.RecordParser ret = io.vertx.reactivex.core.parsetools.RecordParser.newInstance(io.vertx.core.parsetools.RecordParser.newFixed(size, io.vertx.reactivex.impl.ReadStreamSubscriber.asReadStream(stream,obj -> (io.vertx.core.buffer.Buffer)obj.getDelegate()).resume())); return ret; }
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.

Params:
  • delim – the new delimeter
/** * Flip the parser into delimited mode, and where the delimiter can be represented * by the String <code>delim</code> encoded in latin-1 . Don't use this if your String contains other than latin-1 characters. * <p> * This method can be called multiple times with different values of delim while data is being parsed. * @param delim the new delimeter */
public void delimitedMode(String delim) { delegate.delimitedMode(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.

Params:
  • delim – the new delimiter
/** * Flip the parser into delimited mode, and where the delimiter can be represented * by the delimiter <code>delim</code>. * <p> * This method can be called multiple times with different values of delim while data is being parsed. * @param delim the new delimiter */
public void delimitedMode(io.vertx.reactivex.core.buffer.Buffer delim) { delegate.delimitedMode(delim.getDelegate()); }
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.

Params:
  • size – the new record size
/** * Flip the parser into fixed size mode, where the record size is specified by <code>size</code> in bytes. * <p> * This method can be called multiple times with different values of size while data is being parsed. * @param size the new record size */
public void fixedSizeMode(int size) { delegate.fixedSizeMode(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 IllegalStateException will be thrown.

Params:
  • size – the maximum record size
Returns:a reference to this, so the API can be used fluently
/** * Set the maximum allowed size for a record when using the delimited mode. * The delimiter itself does not count for the record size. * <p> * If a record is longer than specified, an {@link java.lang.IllegalStateException} will be thrown. * @param size the maximum record size * @return a reference to this, so the API can be used fluently */
public io.vertx.reactivex.core.parsetools.RecordParser maxRecordSize(int size) { delegate.maxRecordSize(size); return this; }
This method is called to provide the parser with data.
Params:
  • buffer – a chunk of data
/** * This method is called to provide the parser with data. * @param buffer a chunk of data */
public void handle(io.vertx.reactivex.core.buffer.Buffer buffer) { delegate.handle(buffer.getDelegate()); } public io.vertx.reactivex.core.parsetools.RecordParser exceptionHandler(Handler<Throwable> handler) { delegate.exceptionHandler(handler); return this; } public io.vertx.reactivex.core.parsetools.RecordParser handler(Handler<io.vertx.reactivex.core.buffer.Buffer> handler) { delegate.handler(new Handler<io.vertx.core.buffer.Buffer>() { public void handle(io.vertx.core.buffer.Buffer event) { handler.handle(io.vertx.reactivex.core.buffer.Buffer.newInstance(event)); } }); return this; } public io.vertx.reactivex.core.parsetools.RecordParser pause() { delegate.pause(); return this; } public io.vertx.reactivex.core.parsetools.RecordParser fetch(long amount) { delegate.fetch(amount); return this; } public io.vertx.reactivex.core.parsetools.RecordParser resume() { delegate.resume(); return this; } public io.vertx.reactivex.core.parsetools.RecordParser endHandler(Handler<Void> endHandler) { delegate.endHandler(endHandler); return this; } public static RecordParser newInstance(io.vertx.core.parsetools.RecordParser arg) { return arg != null ? new RecordParser(arg) : null; } }