Package com.jsgalactic.axiom.http
Record Class StreamOutcome
java.lang.Object
java.lang.Record
com.jsgalactic.axiom.http.StreamOutcome
- Record Components:
kind- how the body endedbytesWritten- body bytes accepted by the writerelapsed- time from the moment the head was sent to the end of the bodyfailure- what the body threw (including aStreamAbortedException), or null when it returned; a body that swallowed an abort has no failure, but itskindis notStreamOutcome.Kind.COMPLETED
public record StreamOutcome(StreamOutcome.Kind kind, long bytesWritten, Duration elapsed, Throwable failure)
extends Record
How a streamed response body ended, given to the observers registered with
Response.onStreamEnd(java.util.function.Consumer<com.jsgalactic.axiom.http.StreamOutcome>). It describes the body only: the head was sent long before and the status
cannot change.-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionStreamOutcome(StreamOutcome.Kind kind, long bytesWritten, Duration elapsed, Throwable failure) Creates an outcome. -
Method Summary
Modifier and TypeMethodDescriptionlongReturns the value of thebytesWrittenrecord component.booleanReports whether the body ended normally and the client received a final chunk.elapsed()Returns the value of theelapsedrecord component.final booleanIndicates whether some other object is "equal to" this one.failure()Returns the value of thefailurerecord component.final inthashCode()Returns a hash code value for this object.kind()Returns the value of thekindrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
StreamOutcome
public StreamOutcome(StreamOutcome.Kind kind, long bytesWritten, Duration elapsed, Throwable failure) Creates an outcome.- Parameters:
kind- how the body endedbytesWritten- body bytes accepted by the writer, not negativeelapsed- time since the head was sentfailure- what the body threw, or null
-
-
Method Details
-
completed
public boolean completed()Reports whether the body ended normally and the client received a final chunk.- Returns:
- true for
StreamOutcome.Kind.COMPLETED
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
kind
Returns the value of thekindrecord component.- Returns:
- the value of the
kindrecord component
-
bytesWritten
public long bytesWritten()Returns the value of thebytesWrittenrecord component.- Returns:
- the value of the
bytesWrittenrecord component
-
elapsed
Returns the value of theelapsedrecord component.- Returns:
- the value of the
elapsedrecord component
-
failure
Returns the value of thefailurerecord component.- Returns:
- the value of the
failurerecord component
-