Top Inners Fields Constructors Methods
io.vertx.core.streams.impl

public Class PipeImpl<T>

extends Object
implements Pipe<T>
Class Inheritance
All Implemented Interfaces
io.vertx.core.streams.Pipe
Imports
io.vertx.core.AsyncResult, .Future, .Handler, .Promise, .VertxException, io.vertx.core.streams.Pipe, .ReadStream, .WriteStream

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private WriteStream<T>
private boolean
private boolean
private final Promise<Void>
private final ReadStream<T>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements io.vertx.core.streams.Pipe.close.

Close the pipe.

public synchronized Pipe<T>
endOnComplete(boolean
true to end the stream on a source ReadStream completion
end
)

Implements io.vertx.core.streams.Pipe.endOnComplete.

Set to true to call WriteStream#end() when the source ReadStream completes, false otherwise.

public synchronized Pipe<T>
endOnFailure(boolean
true to end the stream on a source ReadStream failure
end
)

Implements io.vertx.core.streams.Pipe.endOnFailure.

Set to true to call WriteStream#end() when the source ReadStream fails, false otherwise.

public synchronized Pipe<T>
endOnSuccess(boolean
true to end the stream on a source ReadStream success
end
)

Implements io.vertx.core.streams.Pipe.endOnSuccess.

Set to true to call WriteStream#end() when the source ReadStream succeeds, false otherwise.

private void
handleFailure(Throwable cause, Handler<AsyncResult<Void>> completionHandler)

private void
handleSuccess(Handler<AsyncResult<Void>> completionHandler)

private void
public void
to(WriteStream<T>
the destination write stream
ws
,
Handler<AsyncResult<Void>>
the handler called when the pipe operation completes
completionHandler
)

Implements io.vertx.core.streams.Pipe.to.

Start to pipe the elements to the destination WriteStream.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

dstback to summary
private WriteStream<T> dst
endOnFailureback to summary
private boolean endOnFailure
endOnSuccessback to summary
private boolean endOnSuccess
resultback to summary
private final Promise<Void> result
srcback to summary
private final ReadStream<T> src

Constructor Detail

PipeImplback to summary
public PipeImpl(ReadStream<T> src)

Method Detail

closeback to summary
public void close()

Implements io.vertx.core.streams.Pipe.close.

Doc from io.vertx.core.streams.Pipe.close.

Close the pipe.

The streams handlers will be unset and the read stream resumed unless it is already ended.

endOnCompleteback to summary
public synchronized Pipe<T> endOnComplete(boolean end)

Implements io.vertx.core.streams.Pipe.endOnComplete.

Doc from io.vertx.core.streams.Pipe.endOnComplete.

Set to true to call WriteStream#end() when the source ReadStream completes, false otherwise.

Calling this overwrites endOnFailure and endOnSuccess.

Parameters
end:boolean

true to end the stream on a source ReadStream completion

Returns:Pipe<T>

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

Annotations
@Override
endOnFailureback to summary
public synchronized Pipe<T> endOnFailure(boolean end)

Implements io.vertx.core.streams.Pipe.endOnFailure.

Doc from io.vertx.core.streams.Pipe.endOnFailure.

Set to true to call WriteStream#end() when the source ReadStream fails, false otherwise.

Parameters
end:boolean

true to end the stream on a source ReadStream failure

Returns:Pipe<T>

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

Annotations
@Override
endOnSuccessback to summary
public synchronized Pipe<T> endOnSuccess(boolean end)

Implements io.vertx.core.streams.Pipe.endOnSuccess.

Doc from io.vertx.core.streams.Pipe.endOnSuccess.

Set to true to call WriteStream#end() when the source ReadStream succeeds, false otherwise.

Parameters
end:boolean

true to end the stream on a source ReadStream success

Returns:Pipe<T>

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

Annotations
@Override
handleFailureback to summary
private void handleFailure(Throwable cause, Handler<AsyncResult<Void>> completionHandler)
handleSuccessback to summary
private void handleSuccess(Handler<AsyncResult<Void>> completionHandler)
handleWriteResultback to summary
private void handleWriteResult(AsyncResult<Void> ack)
toback to summary
public void to(WriteStream<T> ws, Handler<AsyncResult<Void>> completionHandler)

Implements io.vertx.core.streams.Pipe.to.

Doc from io.vertx.core.streams.Pipe.to.

Start to pipe the elements to the destination WriteStream.

When the operation fails with a write error, the source stream is resumed.

Parameters
ws:WriteStream<T>

the destination write stream

completionHandler:Handler<AsyncResult<Void>>

the handler called when the pipe operation completes

Annotations
@Override
io.vertx.core.streams.impl back to summary

private Class PipeImpl.WriteException

extends VertxException
Class Inheritance

Constructor Summary

AccessConstructor and Description
private

Constructor Detail

WriteExceptionback to summary
private WriteException(Throwable cause)