public final class RelocateRange extends Object
Range and a long offset.
A RelocateRange is an instruction sent as part of a ZSync PUT upload,
which informs the server of the new offset of a single range of blocks from the original file. The String
format for this object as it appears in the upload is currently "A-B/C", where A-B
indicates the block range starting at A and ending at B-1, and C represents the location
of this sequence of blocks in the updated (client-side) file.| Modifier and Type | Field and Description |
|---|---|
static String |
DIV
The String separating the Range from the offset in the String representation
of this object.
|
| Constructor and Description |
|---|
RelocateRange(Range range,
long offset)
Constructs a RelocateRange from a Range and offset.
|
| Modifier and Type | Method and Description |
|---|---|
Range |
getBlockRange()
Returns the range of blocks to be relocated.
|
long |
getOffset()
Returns the byte position to which the Range should be relocated.
|
String |
getRelocation()
Returns a String representing this object, e.g. "10-20/1234",
ready to be inserted into a ZSync PUT upload request.
|
static RelocateRange |
parse(String relocString)
Constructs and returns a RelocateRange object from the input String.
|
String |
toString()
Returns a String description of this object, not meant to be inserted into a ZSync PUT.
|
public static final String DIV
public RelocateRange(Range range, long offset)
range - A range of block indices in the remote fileoffset - The new byte position of rangepublic String toString()
getRelocation()public String getRelocation()
public static RelocateRange parse(String relocString) throws ParseException
relocString - The String to be parsedParseException - If the format of the input String is incorrect or the numbers cannot
be properly parsedpublic Range getBlockRange()
The numbers in the Range are indices of the blocks in the server's copy of the file. The Range consists of the pair (firstBlock, lastBlock + 1).
public long getOffset()
Copyright © 2021 McEvoy Software Ltd. All rights reserved.