Package org.globus.ftp
Class ByteRangeList
java.lang.Object
org.globus.ftp.ByteRangeList
- All Implemented Interfaces:
RestartData
Represents list of ranges of integers (ByteRange objects).
The name reflects the fact that in FTP extended mode restart markers, such
structure represent a list of ranges of transfered bytes.
The list has following characteristic:
- no ranges from the list are adjacent nor have any common subset. In other words, for any two list members, r1.merge(r2) always returns ByteRange.THIS_ABOVE or ByteRange.THIS_BELOW
- ranges in the list are ordered by the value of "from" field (or "to" field; it's the same)
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
int
hashCode()
void
Merge into this list all the ranges contained in the given vector using merge(ByteRange).void
Merge a copy of the given ByteRange into this list.void
merge
(ByteRangeList other) Merge into this list all the ranges contained in the given ByteRangeList using merge(ByteRange).convert this object to a String, in the format of argument of REST GridFTP command, for instance: "0-29,32-89" The resulting String will preserve the features of ByteRangeList: (1) order and (2) separationtoVector()
convert this object to a vector of ByteRanges.
-
Field Details
-
logger
private static org.apache.commons.logging.Log logger -
vector
vector of ByteRanges. It is guaranteed that any two ranges are not adjacent to each other, nor have a common subset. They are unordered, however.
-
-
Constructor Details
-
ByteRangeList
public ByteRangeList()
-
-
Method Details
-
equals
-
hashCode
public int hashCode() -
merge
Merge a copy of the given ByteRange into this list. The resulting range list will represent all the integers represented so far, plus the integers represented by the new range. The resulting list will be stored in this object, while the parameter object will remain intact. For instance:- merge("10-15 30-35", "20-25") -< "10-15 20-25 30-35"
- merge("10-15 30-35", "12-15") -< "10-15 20-25"
- merge("10-15 30-35", "16-40") -< "10-40"
-
merge
Merge into this list all the ranges contained in the given vector using merge(ByteRange).- Parameters:
other
- the Vector of ByteRange objects
-
merge
Merge into this list all the ranges contained in the given ByteRangeList using merge(ByteRange). The parameter object remains intact.- Parameters:
other
- the ByteRangeList to be merged into this
-
toVector
convert this object to a vector of ByteRanges. The resulting vector will preserve the features of ByteRangeList: (1) order and (2) separation. Subsequent calls of this method will return the same Vector object. -
toFtpCmdArgument
convert this object to a String, in the format of argument of REST GridFTP command, for instance: "0-29,32-89" The resulting String will preserve the features of ByteRangeList: (1) order and (2) separation- Specified by:
toFtpCmdArgument
in interfaceRestartData
- Returns:
- the restart data in the format of REST command argument. For instance (in GridFTP) "4-50,62-75"
-