java.lang.Comparable<PartialPiece>
class PartialPiece extends java.lang.Object implements java.lang.Comparable<PartialPiece>
コンストラクタ | 説明 |
---|---|
PartialPiece(Piece piece,
int len,
java.io.File tempDir) |
Used by PeerCoordinator.
|
修飾子とタイプ | メソッド | 説明 |
---|---|---|
int |
compareTo(PartialPiece opp) |
|
boolean |
equals(java.lang.Object o) |
Make this simple so PeerCoordinator can keep a List.
|
int |
getDownloaded() |
How many bytes are good - as set by setDownloaded() or read()
|
byte[] |
getHash() |
Piece must be complete.
|
int |
getLength() |
|
int |
getPiece() |
piece number
|
Request |
getRequest() |
Convert this PartialPiece to a request for the next chunk.
|
int |
hashCode() |
|
void |
read(java.io.DataInputStream din,
int offset,
int len) |
Blocking.
|
void |
release() |
Release all resources.
|
void |
setDownloaded(int offset) |
Call this if necessary before returning a PartialPiece to the PeerCoordinator.
|
java.lang.String |
toString() |
|
void |
write(java.io.DataOutput out,
int offset,
int len) |
Piece must be complete.
|
public PartialPiece(Piece piece, int len, java.io.File tempDir)
piece
- Piece number requested.len
- must be equal to the piece lengthpublic Request getRequest()
public int getPiece()
public int getLength()
public int getDownloaded()
public void setDownloaded(int offset)
public byte[] getHash() throws java.io.IOException
java.io.IOException
public void read(java.io.DataInputStream din, int offset, int len) throws java.io.IOException
java.io.IOException
public void write(java.io.DataOutput out, int offset, int len) throws java.io.IOException
out
- stream to write tooffset
- offset in the piecelen
- length to writejava.io.IOException
public void release()
public int compareTo(PartialPiece opp)
compareTo
インタフェース内 java.lang.Comparable<PartialPiece>
public int hashCode()
hashCode
クラス内 java.lang.Object
public boolean equals(java.lang.Object o)
equals
クラス内 java.lang.Object
public java.lang.String toString()
toString
クラス内 java.lang.Object