Package com.github.ambry.router
Class ByteRanges
- java.lang.Object
-
- com.github.ambry.router.ByteRanges
-
public class ByteRanges extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ByteRange
fromLastNBytes(long lastNBytes)
Construct a range that represents the last N bytes of an object.static ByteRange
fromOffsetRange(long startOffset, long endOffset)
Construct a range from a start offset to an end offset.static ByteRange
fromStartOffset(long startOffset)
Construct a range from a start offset to the end of an object.
-
-
-
Method Detail
-
fromOffsetRange
public static ByteRange fromOffsetRange(long startOffset, long endOffset)
Construct a range from a start offset to an end offset.- Parameters:
startOffset
- the (inclusive) start byte offset.endOffset
- the (inclusive) end byte offset.- Returns:
- A
ByteRange
with the specified offsets. - Throws:
java.lang.IllegalArgumentException
- if the start offset is less than 0, or the end offset is less than the start.
-
fromStartOffset
public static ByteRange fromStartOffset(long startOffset)
Construct a range from a start offset to the end of an object.- Parameters:
startOffset
- The (inclusive) start byte offset.- Returns:
- A
ByteRange
with the specified start offset. - Throws:
java.lang.IllegalArgumentException
- if the start offset is less than 0
-
fromLastNBytes
public static ByteRange fromLastNBytes(long lastNBytes)
Construct a range that represents the last N bytes of an object.- Parameters:
lastNBytes
- the number of bytes to read from the end of an object.- Returns:
- A
ByteRange
representing the last N bytes of an objects. - Throws:
java.lang.IllegalArgumentException
- if the number of bytes to read is less than or equal to 0.
-
-