trait
Writable extends Any
Abstract Value Members
-
abstract
def
getClass(): Class[_]
-
abstract
def
writeBytesTo(out: OutputStream): Unit
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
-
final
def
##(): Int
-
final
def
==(arg0: Any): Boolean
-
final
def
asInstanceOf[T0]: T0
-
def
contentLength: Option[Long]
-
def
equals(arg0: Any): Boolean
-
def
hashCode(): Int
-
def
httpContentType: Option[String]
-
final
def
isInstanceOf[T0]: Boolean
-
def
toString(): String
A Writable is a source of bytes that can be written to an OutputStream.
Essentially a push-based version of
java.io.InputStream
, that allows an implementation to guarantee that cleanup logic runs after the bytes are written.Writable is also much easier to implement than
java.io.InputStream
: any code that previously wrote output to anByteArrayOutputStream
orStringBuilder
can trivially satisfy the Writable interface. That makes Writable very convenient to use for allowing zero-friction zero-overhead streaming data exchange between different libraries.Writable comes with implicit constructors from
Array[Byte]
,String
andInputStream
, and is itself a tiny interface with minimal functionality. Libraries using Writable are expected to extend it to provide additional methods or additional implicit constructors that make sense in their context.