class MagnetState extends Object
| Modifier and Type | Field | Description |
|---|---|---|
static int |
CHUNK_SIZE |
| Constructor | Description |
|---|---|
MagnetState(byte[] iHash,
MetaInfo meta) |
| Modifier and Type | Method | Description |
|---|---|---|
int |
chunkSize(int chunk) |
|
int |
chunksRemaining() |
|
byte[] |
getChunk(int chunk) |
|
MetaInfo |
getMetaInfo() |
|
int |
getNextRequest() |
|
int |
getSize() |
|
void |
initialize(int size) |
Call this for a new magnet when you have the size
|
boolean |
isComplete() |
|
boolean |
isInitialized() |
|
boolean |
saveChunk(int chunk,
byte[] data,
int off,
int length) |
|
void |
setMetaInfo(MetaInfo meta) |
Call this for a new magnet when the download is complete.
|
public static final int CHUNK_SIZE
public MagnetState(byte[] iHash,
MetaInfo meta)
meta - null for new magnetpublic void initialize(int size)
IllegalArgumentExceptionpublic void setMetaInfo(MetaInfo meta)
IllegalArgumentExceptionpublic MetaInfo getMetaInfo()
IllegalArgumentExceptionpublic int getSize()
IllegalArgumentExceptionpublic boolean isInitialized()
public boolean isComplete()
public int chunkSize(int chunk)
public int chunksRemaining()
public int getNextRequest()
public byte[] getChunk(int chunk)
IllegalArgumentExceptionpublic boolean saveChunk(int chunk,
byte[] data,
int off,
int length)
throws Exception
NullPointerException - IllegalArgumentException, IOException, ...Exception