sealed abstract
class
Chunk extends AnyRef
Abstract Value Members
-
abstract
def
content: Buf
-
abstract
def
isLast: Boolean
-
abstract
def
trailers: HeaderMap
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
-
final
def
##(): Int
-
final
def
==(arg0: Any): Boolean
-
final
def
asInstanceOf[T0]: T0
-
def
clone(): AnyRef
-
-
-
def
finalize(): Unit
-
final
def
getClass(): Class[_]
-
def
hashCode(): Int
-
final
def
isInstanceOf[T0]: Boolean
-
-
final
def
notify(): Unit
-
final
def
notifyAll(): Unit
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
-
def
toString(): String
-
final
def
wait(): Unit
-
final
def
wait(arg0: Long, arg1: Int): Unit
-
final
def
wait(arg0: Long): Unit
Represents a piece of an HTTP stream, commonly referred to as a chunk.
HTTP semantics treat trailing headers as the end of stream signal hence no writes (neither trailers nor data) are allowed after them, only
close
(EOS) is valid. This is typically enforced by an HTTP dispatcher in both clients and servers.Similarly, when consumed via com.twitter.io.Reader, trailers are always followed by
None
, readers's EOS. Users MUST read until the end of stream to ensure resource hygiene.The following example demonstrates one way of doing so: wiring in one extra read before returning from a read-loop:
The HTTP dispatcher guarantees that
Chunk.Last
will be issued in the inbound stream no matter if itstrailers
orcontent
present.Note: when consuming interleaved HTTP streams (i.e., via
Reader.flatMap
) it's expected to observe multiple trailers before reaching the EOS. These inter-stream trailers space out individual HTTP streams from child readers.