Trait

com.twitter.io.Reader

Writable

Related Doc: package Reader

Permalink

trait Writable extends Reader with Writer with Closable

A Reader that is linked with a Writer and close-ing is synchronous.

Just as with readers and writers, only one outstanding read or write is permitted.

For a proper close, it should only be done when no writes are outstanding:

val rw = Reader.writable()
...
rw.write(buf).before(rw.close())

If a producer is interested in knowing when all writes have been read and the reader has seen the EOF, it can wait until the future returned by close() is satisfied:

val rw = Reader.writable()
...
rw.close().ensure {
  println("party on! ♪┏(・o・)┛♪ the Reader has seen the EOF")
}
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Writable
  2. Closable
  3. Writer
  4. Reader
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def close(deadline: Time): Future[Unit]

    Permalink

    Close the resource with the given deadline.

    Close the resource with the given deadline. This deadline is advisory, giving the callee some leeway, for example to drain clients or finish up other tasks.

    Definition Classes
    Closable
  2. abstract def discard(): Unit

    Permalink

    Discard this reader: its output is no longer required.

    Discard this reader: its output is no longer required.

    Definition Classes
    Reader
  3. abstract def fail(cause: Throwable): Unit

    Permalink

    Indicate that the producer of the bytestream has failed.

    Indicate that the producer of the bytestream has failed. No further writes are allowed.

    Definition Classes
    Writer
  4. abstract def read(n: Int): Future[Option[Buf]]

    Permalink

    Asynchronously read at most n bytes from the byte stream.

    Asynchronously read at most n bytes from the byte stream. The returned future represents the results of the read request. If the read fails, the Reader is considered failed -- future reads will also fail.

    A result of None indicates EOF.

    Definition Classes
    Reader
  5. abstract def write(buf: Buf): Future[Unit]

    Permalink

    Write a chunk.

    Write a chunk. The returned future is completed when the chunk has been fully read by the sink.

    Only one outstanding write is permitted, thus backpressure is asserted.

    Definition Classes
    Writer

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. def close(after: Duration): Future[Unit]

    Permalink

    Close the resource with the given timeout.

    Close the resource with the given timeout. This timeout is advisory, giving the callee some leeway, for example to drain clients or finish up other tasks.

    Definition Classes
    Closable
  7. final def close(): Future[Unit]

    Permalink

    Close the resource.

    Close the resource. The returned Future is completed when the resource has been fully relinquished.

    Definition Classes
    Closable
  8. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  9. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  10. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  11. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  12. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  13. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  14. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  15. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  16. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  17. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  18. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  19. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  20. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  21. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Closable

Inherited from Writer

Inherited from Reader

Inherited from AnyRef

Inherited from Any

Ungrouped