trait ReadStream[T] extends StreamBase
Represents a stream of items that can be read from.
Any class that implements this interface can be used by a io.vertx.scala.core.streams.Pump to pump data from it to a io.vertx.scala.core.streams.WriteStream.
Streaming mode
The stream is either in flowing or fetch mode.
Initially the stream is in flowing mode.
- When the stream is in flowing mode, elements are delivered to the
handler
. - When the stream is in fetch mode, only the number of requested elements will be delivered to the
handler
.
The mode can be changed with the io.vertx.scala.core.streams.ReadStream#pause, io.vertx.scala.core.streams.ReadStream#resume and io.vertx.scala.core.streams.ReadStream#fetch methods:
- Calling io.vertx.scala.core.streams.ReadStream#resume sets the flowing mode
- Calling io.vertx.scala.core.streams.ReadStream#pause sets the fetch mode and resets the demand to
0
- Calling io.vertx.scala.core.streams.ReadStream#fetch requests a specific amount of elements and adds it to the actual demand
- Alphabetic
- By Inheritance
- ReadStream
- StreamBase
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Abstract Value Members
-
abstract
def
asJava: AnyRef
- Definition Classes
- ReadStream → StreamBase
-
abstract
def
endHandler(endHandler: Handler[Unit]): ReadStream[T]
Set an end handler.
Set an end handler. Once the stream has ended, and there is no more data to be read, this handler will be called. * @return a reference to this, so the API can be used fluently
-
abstract
def
exceptionHandler(handler: Handler[Throwable]): ReadStream[T]
Set an exception handler on the read stream.
Set an exception handler on the read stream. * @param handler the exception handler
- returns
a reference to this, so the API can be used fluently
- Definition Classes
- ReadStream → StreamBase
-
abstract
def
fetch(amount: Long): ReadStream[T]
Fetch the specified
amount
of elements.Fetch the specified
amount
of elements. If theReadStream
has been paused, reading will recommence with the specifiedamount
of items, otherwise the specifiedamount
will be added to the current stream demand. * @return a reference to this, so the API can be used fluently -
abstract
def
handler(handler: Handler[T]): ReadStream[T]
Set a data handler.
Set a data handler. As data is read, the handler will be called with the data. * @return a reference to this, so the API can be used fluently
-
abstract
def
pause(): ReadStream[T]
Pause the
ReadStream
, it sets the buffer infetch
mode and clears the actual demand.Pause the
ReadStream
, it sets the buffer infetch
mode and clears the actual demand.While it's paused, no data will be sent to the data
handler
. * @return a reference to this, so the API can be used fluently -
abstract
def
pipe(): Pipe[T]
Pause this stream and return a io.vertx.scala.core.streams.Pipe to transfer the elements of this stream to a destination io.vertx.scala.core.streams.WriteStream.
Pause this stream and return a io.vertx.scala.core.streams.Pipe to transfer the elements of this stream to a destination io.vertx.scala.core.streams.WriteStream.
The stream will be resumed when the pipe will be wired to a
WriteStream
. * @return a pipe -
abstract
def
pipeTo(dst: WriteStream[T], handler: Handler[AsyncResult[Unit]]): Unit
Pipe this
ReadStream
to theWriteStream
.Pipe this
ReadStream
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. * @param dst the destination write stream -
abstract
def
pipeTo(dst: WriteStream[T]): Unit
Like io.vertx.scala.core.streams.ReadStream#pipeTo but with no completion handler.
-
abstract
def
pipeToFuture(dst: WriteStream[T]): scala.concurrent.Future[Unit]
Like pipeTo but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.
-
abstract
def
resume(): ReadStream[T]
Resume reading, and sets the buffer in
flowing
mode.Resume reading, and sets the buffer in
flowing
mode.If the
ReadStream
has been paused, reading will recommence on it. * @return a reference to this, so the API can be used fluently
Concrete 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
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
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
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( ... )