Record Class ByteRange
java.lang.Object
java.lang.Record
org.exoplatform.documents.rest.model.ByteRange
- Record Components:
start- the first byte servedend- the last byte served
A single byte range of a content, as asked by an HTTP Range header, its
bounds included.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ByteRangeA range that lies wholly outside the content, answered with a 416. -
Constructor Summary
ConstructorsConstructorDescriptionByteRange(long start, long end) Creates an instance of aByteRangerecord class. -
Method Summary
Modifier and TypeMethodDescriptionlongend()Returns the value of theendrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.longlength()The number of bytes the range serves.static ByteRangeReads the Range header of a request against the size of the content it asks for.longstart()Returns the value of thestartrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
NOT_SATISFIABLE
A range that lies wholly outside the content, answered with a 416.
-
-
Constructor Details
-
ByteRange
-
-
Method Details
-
parse
Reads the Range header of a request against the size of the content it asks for.- Parameters:
header- the Range header, or nullsize- the size of the content, in bytes- Returns:
- the range to serve;
NOT_SATISFIABLEwhen it starts beyond the content; null when the whole content is to be served: no header, an empty content, a malformed header or several ranges
-
length
public long length()The number of bytes the range serves.- Returns:
- the range's length
-
toString
-
hashCode
-
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. All components in this record class are compared with thecomparemethod from their corresponding wrapper classes. -
start
-
end
-