http4k / org.http4k.core / BodyMode
sealed class BodyMode : (
InputStream
) ->
Body
BodyMode represents a choice between working lazily with streams or eagerly storing the body contents in memory.
This choice comes with the following trade-offs:
Memory
does not require any special treatment. However, you need to be confident that the sum of all “in-flight”
body bytes does not exceed your JVM heap. Otherwise, you’ll run into `OutOfMemoryException’s.
Stream
, on the other hand, allows you to handle payloads of any size, but you’ll need to make sure that:
close()
is called appropriately.Name | Summary |
---|---|
Memory | object Memory : BodyMode |
Stream | object Stream : BodyMode |