Package rife.engine
Record Class ByteRange
java.lang.Object
java.lang.Record
rife.engine.ByteRange
- Record Components:
start- the position of the first byteend- the position of the last byte, inclusive
A single byte range of a
Range request header, resolved against
the length of the content it applies to.- Since:
- 1.11.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ByteRangeThe result of parsing a range that the content can't satisfy, which should be answered with a416status. -
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()Retrieves the number of bytes in this range.static ByteRangeParses the value of aRangerequest header.longstart()Returns the value of thestartrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
UNSATISFIABLE
The result of parsing a range that the content can't satisfy, which should be answered with a416status. Compare a parsed range to it with==.- Since:
- 1.11.0
-
-
Constructor Details
-
Method Details
-
parse
Parses the value of aRangerequest header.Only a single range of bytes is supported, for anything else
nullis returned so that the whole content can be served, as HTTP allows.- Parameters:
header- the value of theRangeheaderlength- the length of the content in bytes- Returns:
- the requested range;
UNSATISFIABLEif the content can't satisfy it; ornullif the whole content should be served - Since:
- 1.11.0
-
length
public long length()Retrieves the number of bytes in this range.- Returns:
- the length of this range
- Since:
- 1.11.0
-
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. All components in this record class are compared with '=='. -
start
public long start()Returns the value of thestartrecord component.- Returns:
- the value of the
startrecord component
-
end
public long end()Returns the value of theendrecord component.- Returns:
- the value of the
endrecord component
-