Class RecordParser
- All Implemented Interfaces:
MutinyDelegate
,io.vertx.core.Handler<Buffer>
,ReadStream<Buffer>
,StreamBase
,Consumer<Buffer>
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:\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.
NOTE: This class has been automatically generated from theoriginal
non Mutiny-ified interface using Vert.x codegen.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionRecordParser
(io.vertx.core.parsetools.RecordParser delegate) RecordParser
(Object delegate) -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
delimitedMode
(Buffer delim) void
delimitedMode
(String delim) endHandler
(Runnable endHandler) boolean
exceptionHandler
(Consumer<Throwable> handler) fetch
(long amount) void
fixedSizeMode
(int size) io.vertx.core.parsetools.RecordParser
void
int
hashCode()
maxRecordSize
(int size) static RecordParser
newDelimited
(Buffer delim) static RecordParser
newDelimited
(Buffer delim, ReadStream<Buffer> stream) static RecordParser
newDelimited
(Buffer delim, Flow.Publisher<Buffer> stream) static RecordParser
newDelimited
(Buffer delim, Consumer<Buffer> output) static RecordParser
newDelimited
(String delim) static RecordParser
newDelimited
(String delim, ReadStream<Buffer> stream) static RecordParser
newDelimited
(String delim, Flow.Publisher<Buffer> stream) static RecordParser
newDelimited
(String delim, Consumer<Buffer> output) static RecordParser
newFixed
(int size) static RecordParser
newFixed
(int size, ReadStream<Buffer> stream) static RecordParser
newFixed
(int size, Flow.Publisher<Buffer> stream) static RecordParser
static RecordParser
newInstance
(io.vertx.core.parsetools.RecordParser arg) pause()
pipe()
io.smallrye.mutiny.Uni<Void>
pipeTo
(WriteStream<Buffer> dst) Pipe thisReadStream
to theWriteStream
.pipeToAndAwait
(WriteStream<Buffer> dst) Blocking variant ofReadStream.pipeTo(io.vertx.mutiny.core.streams.WriteStream)
.void
pipeToAndForget
(WriteStream<Buffer> dst) Variant ofReadStream.pipeTo(io.vertx.mutiny.core.streams.WriteStream)
that ignores the result of the operation.resume()
void
io.smallrye.mutiny.Multi<Buffer>
toMulti()
toString()
-
Field Details
-
__TYPE_ARG
-
-
Constructor Details
-
RecordParser
public RecordParser(io.vertx.core.parsetools.RecordParser delegate) -
RecordParser
-
-
Method Details
-
getDelegate
public io.vertx.core.parsetools.RecordParser getDelegate()- Specified by:
getDelegate
in interfaceMutinyDelegate
- Specified by:
getDelegate
in interfaceReadStream<Buffer>
- Specified by:
getDelegate
in interfaceStreamBase
- Returns:
- the delegate used by this Mutiny object of generated type
-
toString
-
equals
-
hashCode
public int hashCode() -
pipe
- Specified by:
pipe
in interfaceReadStream<Buffer>
- Returns:
- a pipe
-
pipeTo
Pipe thisReadStream
to theWriteStream
.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.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Specified by:
pipeTo
in interfaceReadStream<Buffer>
- Parameters:
dst
- the destination write stream- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
pipeToAndAwait
Blocking variant ofReadStream.pipeTo(io.vertx.mutiny.core.streams.WriteStream)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Specified by:
pipeToAndAwait
in interfaceReadStream<Buffer>
- Parameters:
dst
- the destination write stream- Returns:
- the Void instance produced by the operation.
-
pipeToAndForget
Variant ofReadStream.pipeTo(io.vertx.mutiny.core.streams.WriteStream)
that ignores the result of the operation.This method subscribes on the result of
ReadStream.pipeTo(io.vertx.mutiny.core.streams.WriteStream)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromReadStream.pipeTo(io.vertx.mutiny.core.streams.WriteStream)
but you don't need to compose it with other operations.- Specified by:
pipeToAndForget
in interfaceReadStream<Buffer>
- Parameters:
dst
- the destination write stream
-
setOutput
-
newDelimited
- Parameters:
delim
- the initial delimiter stringoutput
- handler that will receive the output- Returns:
-
newDelimited
- Parameters:
delim
- the initial delimiter stringstream
- the wrapped stream- Returns:
-
newDelimited
- Parameters:
delim
- the initial delimiter stringstream
- the wrapped stream- Returns:
-
newDelimited
- Parameters:
delim
- the initial delimiter string- Returns:
-
newDelimited
- Parameters:
delim
- the initial delimiter buffer- Returns:
-
newDelimited
- Parameters:
delim
- the initial delimiter bufferoutput
- handler that will receive the output- Returns:
-
newDelimited
- Parameters:
delim
- the initial delimiter bufferstream
- the wrapped stream- Returns:
-
newDelimited
- Parameters:
delim
- the initial delimiter bufferstream
- the wrapped stream- Returns:
-
newFixed
- Parameters:
size
- the initial record size- Returns:
-
newFixed
- Parameters:
size
- the initial record sizeoutput
- handler that will receive the output- Returns:
-
newFixed
- Parameters:
size
- the initial record sizestream
- the wrapped stream- Returns:
-
newFixed
- Parameters:
size
- the initial record sizestream
- the wrapped stream- Returns:
-
delimitedMode
- Parameters:
delim
- the new delimeter
-
delimitedMode
- Parameters:
delim
- the new delimiter
-
fixedSizeMode
public void fixedSizeMode(int size) - Parameters:
size
- the new record size
-
maxRecordSize
- Parameters:
size
- the maximum record size- Returns:
- a reference to this, so the API can be used fluently
-
handle
- Specified by:
handle
in interfaceio.vertx.core.Handler<Buffer>
- Parameters:
buffer
- a chunk of data
-
exceptionHandler
- Specified by:
exceptionHandler
in interfaceReadStream<Buffer>
- Specified by:
exceptionHandler
in interfaceStreamBase
- Parameters:
handler
- the exception handler- Returns:
-
handler
- Specified by:
handler
in interfaceReadStream<Buffer>
- Returns:
-
pause
- Specified by:
pause
in interfaceReadStream<Buffer>
- Returns:
- a reference to this, so the API can be used fluently
-
fetch
- Specified by:
fetch
in interfaceReadStream<Buffer>
- Returns:
- a reference to this, so the API can be used fluently
-
resume
- Specified by:
resume
in interfaceReadStream<Buffer>
- Returns:
- a reference to this, so the API can be used fluently
-
endHandler
- Specified by:
endHandler
in interfaceReadStream<Buffer>
- Returns:
-
toMulti
- Specified by:
toMulti
in interfaceReadStream<Buffer>
-
toBlockingIterable
-
toBlockingStream
-
accept
-
newInstance
-