public class Range
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static long |
INDEX_FIRST
Index for the first byte (or range unit) of an entity.
|
static long |
INDEX_LAST
Index for the last byte (or range unit) of an entity.
|
static java.lang.String |
RANGE_BYTES_UNIT |
static long |
SIZE_MAX
Maximum size available from the index.
|
| Constructor and Description |
|---|
Range()
Default constructor defining a range starting on the first byte and with
a maximum size, i.e. covering the whole entity.
|
Range(long size)
Constructor defining a range starting on the first byte and with the
given size.
|
Range(long index,
long size)
Constructor.
|
Range(long index,
long size,
long instanceSize,
java.lang.String unitName)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object object) |
long |
getIndex()
Returns the index from which to start the range.
|
long |
getInstanceSize()
Returns the total size of the instance in number of bytes (or range unit).
|
long |
getSize()
Returns the size of the range in number of bytes.
|
java.lang.String |
getUnitName()
Returns the name of the range unit.
|
int |
hashCode() |
static boolean |
isBytesRange(Range range)
Indicates if the unit of the given range is "bytes".
|
boolean |
isIncluded(long position,
long totalSize)
Indicates if the given index is included in the range.
|
void |
setIndex(long index)
Sets the index from which to start the range.
|
void |
setInstanceSize(long instanceSize)
Sets the total size of the instance in number of bytes (or range unit).
|
void |
setSize(long size)
Sets the size of the range in number of bytes.
|
void |
setUnitName(java.lang.String unitName)
Sets the name of the range unit.
|
public static final long INDEX_FIRST
public static final long INDEX_LAST
public static final java.lang.String RANGE_BYTES_UNIT
public static final long SIZE_MAX
public Range()
public Range(long size)
size - Size of the range in number of bytes.public Range(long index,
long size)
index - Index from which to start the rangesize - Size of the range in number of bytes.public Range(long index,
long size,
long instanceSize,
java.lang.String unitName)
index - Index from which to start the rangesize - Size of the range in number of bytes.instanceSize - Size of the instance in number of bytes.unitName - Unit of the range.public static boolean isBytesRange(Range range)
range - The range.public boolean equals(java.lang.Object object)
equals in class java.lang.Objectpublic long getIndex()
INDEX_FIRST (0), starting at the first
byte.public long getInstanceSize()
public long getSize()
public java.lang.String getUnitName()
public int hashCode()
hashCode in class java.lang.Objectpublic boolean isIncluded(long position,
long totalSize)
position - The position to test.totalSize - public void setIndex(long index)
INDEX_FIRST (0), starting at the first byteindex - The index from which to start the range.public void setInstanceSize(long instanceSize)
instanceSize - The total size of the instance.public void setSize(long size)
size - The size of the range in number of bytes.public void setUnitName(java.lang.String unitName)
unitName - The name of the range unit.Copyright © 2005-2024 Restlet.