class MagnetState extends Object
Modifier and Type | Field and Description |
---|---|
static int |
CHUNK_SIZE |
Constructor and Description |
---|
MagnetState(byte[] iHash,
MetaInfo meta) |
Modifier and Type | Method and 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)
IllegalArgumentException
public void setMetaInfo(MetaInfo meta)
IllegalArgumentException
public MetaInfo getMetaInfo()
IllegalArgumentException
public int getSize()
IllegalArgumentException
public boolean isInitialized()
public boolean isComplete()
public int chunkSize(int chunk)
public int chunksRemaining()
public int getNextRequest()
public byte[] getChunk(int chunk)
IllegalArgumentException
public boolean saveChunk(int chunk, byte[] data, int off, int length) throws Exception
NullPointerException
- IllegalArgumentException, IOException, ...Exception