class Pipe[T] extends AnyRef
Pipe data from a io.vertx.scala.core.streams.ReadStream to a io.vertx.scala.core.streams.WriteStream and performs flow control where necessary to prevent the write stream buffer from getting overfull.
Instances of this class read items from a io.vertx.scala.core.streams.ReadStream and write them to a io.vertx.scala.core.streams.WriteStream. If data can be read faster than it can be written this could result in the write queue of the io.vertx.scala.core.streams.WriteStream growing without bound, eventually causing it to exhaust all available RAM.
To prevent this, after each write, instances of this class check whether the write queue of the io.vertx.scala.core.streams.WriteStream is full, and if so, the io.vertx.scala.core.streams.ReadStream is paused, and a drainHandler
is set on the
io.vertx.scala.core.streams.WriteStream.
When the io.vertx.scala.core.streams.WriteStream has processed half of its backlog, the drainHandler
will be
called, which results in the pump resuming the io.vertx.scala.core.streams.ReadStream.
This class can be used to pipe from any io.vertx.scala.core.streams.ReadStream to any io.vertx.scala.core.streams.WriteStream, e.g. from an io.vertx.scala.core.http.HttpServerRequest to an io.vertx.scala.core.file.AsyncFile, or from io.vertx.scala.core.net.NetSocket to a io.vertx.scala.core.http.WebSocket.
Please see the documentation for more information.
- Alphabetic
- By Inheritance
- Pipe
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new Pipe(_asJava: AnyRef)(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[T])
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
- def asJava: AnyRef
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
def
close(): Unit
Close the pipe.
Close the pipe.
The streams handlers will be unset and the read stream resumed unless it is already ended.
-
def
endOnComplete(end: Boolean): Pipe[T]
Set to
true
to call io.vertx.scala.core.streams.WriteStream#end when the sourceReadStream
completes,false
otherwise.Set to
true
to call io.vertx.scala.core.streams.WriteStream#end when the sourceReadStream
completes,false
otherwise.Calling this overwrites io.vertx.scala.core.streams.Pipe#endOnFailure and io.vertx.scala.core.streams.Pipe#endOnSuccess. * @param end
true
to end the stream on a sourceReadStream
completion- returns
a reference to this, so the API can be used fluently
-
def
endOnFailure(end: Boolean): Pipe[T]
Set to
true
to call io.vertx.scala.core.streams.WriteStream#end when the sourceReadStream
fails,false
otherwise.Set to
true
to call io.vertx.scala.core.streams.WriteStream#end when the sourceReadStream
fails,false
otherwise. * @param endtrue
to end the stream on a sourceReadStream
failure- returns
a reference to this, so the API can be used fluently
-
def
endOnSuccess(end: Boolean): Pipe[T]
Set to
true
to call io.vertx.scala.core.streams.WriteStream#end when the sourceReadStream
succeeds,false
otherwise.Set to
true
to call io.vertx.scala.core.streams.WriteStream#end when the sourceReadStream
succeeds,false
otherwise. * @param endtrue
to end the stream on a sourceReadStream
success- returns
a reference to this, so the API can be used fluently
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
to(dst: WriteStream[T], completionHandler: Handler[AsyncResult[Unit]]): Unit
Start to pipe the elements to the destination
WriteStream
.Start to pipe the elements to the destination
WriteStream
.When the operation fails with a write error, the source stream is resumed. * @param dst the destination write stream
- completionHandler
the handler called when the pipe operation completes
-
def
to(dst: WriteStream[T]): Unit
Like io.vertx.scala.core.streams.Pipe#to but without a completion handler
-
def
toFuture(dst: WriteStream[T]): scala.concurrent.Future[Unit]
Like to but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )