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 TypeMethodDescriptionvoidvoiddelimitedMode(Buffer delim) voiddelimitedMode(String delim) endHandler(Runnable endHandler) booleanexceptionHandler(Consumer<Throwable> handler) fetch(long amount) voidfixedSizeMode(int size) io.vertx.core.parsetools.RecordParservoidinthashCode()maxRecordSize(int size) static RecordParsernewDelimited(Buffer delim) static RecordParsernewDelimited(Buffer delim, ReadStream<Buffer> stream) static RecordParsernewDelimited(Buffer delim, Flow.Publisher<Buffer> stream) static RecordParsernewDelimited(Buffer delim, Consumer<Buffer> output) static RecordParsernewDelimited(String delim) static RecordParsernewDelimited(String delim, ReadStream<Buffer> stream) static RecordParsernewDelimited(String delim, Flow.Publisher<Buffer> stream) static RecordParsernewDelimited(String delim, Consumer<Buffer> output) static RecordParsernewFixed(int size) static RecordParsernewFixed(int size, ReadStream<Buffer> stream) static RecordParsernewFixed(int size, Flow.Publisher<Buffer> stream) static RecordParserstatic RecordParsernewInstance(io.vertx.core.parsetools.RecordParser arg) pause()pipe()io.smallrye.mutiny.Uni<Void>pipeTo(WriteStream<Buffer> dst) Pipe thisReadStreamto theWriteStream.pipeToAndAwait(WriteStream<Buffer> dst) Blocking variant ofReadStream.pipeTo(io.vertx.mutiny.core.streams.WriteStream).voidpipeToAndForget(WriteStream<Buffer> dst) Variant ofReadStream.pipeTo(io.vertx.mutiny.core.streams.WriteStream)that ignores the result of the operation.resume()voidio.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:
getDelegatein interfaceMutinyDelegate- Specified by:
getDelegatein interfaceReadStream<Buffer>- Specified by:
getDelegatein interfaceStreamBase- Returns:
- the delegate used by this Mutiny object of generated type
-
toString
-
equals
-
hashCode
public int hashCode() -
pipe
- Specified by:
pipein interfaceReadStream<Buffer>- Returns:
- a pipe
-
pipeTo
Pipe thisReadStreamto 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
handlerwill 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:
pipeToin interfaceReadStream<Buffer>- Parameters:
dst- the destination write stream- Returns:
- the
unifiring 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:
pipeToAndAwaitin 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:
pipeToAndForgetin 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:
handlein interfaceio.vertx.core.Handler<Buffer>- Parameters:
buffer- a chunk of data
-
exceptionHandler
- Specified by:
exceptionHandlerin interfaceReadStream<Buffer>- Specified by:
exceptionHandlerin interfaceStreamBase- Parameters:
handler- the exception handler- Returns:
-
handler
- Specified by:
handlerin interfaceReadStream<Buffer>- Returns:
-
pause
- Specified by:
pausein interfaceReadStream<Buffer>- Returns:
- a reference to this, so the API can be used fluently
-
fetch
- Specified by:
fetchin interfaceReadStream<Buffer>- Returns:
- a reference to this, so the API can be used fluently
-
resume
- Specified by:
resumein interfaceReadStream<Buffer>- Returns:
- a reference to this, so the API can be used fluently
-
endHandler
- Specified by:
endHandlerin interfaceReadStream<Buffer>- Returns:
-
toMulti
- Specified by:
toMultiin interfaceReadStream<Buffer>
-
toBlockingIterable
-
toBlockingStream
-
accept
-
newInstance
-