Package org.johnnei.javatorrent.disk
Class DiskJobWriteBlock
- java.lang.Object
-
- org.johnnei.javatorrent.disk.DiskJobWriteBlock
-
-
Constructor Summary
Constructors Constructor Description DiskJobWriteBlock(Piece piece, int blockIndex, byte[] data, Consumer<DiskJobWriteBlock> callback)Creates a new job to store a block of a piece.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetBlockIndex()Gets the block index within the owning piece.PiecegetPiece()Gets the piece for which this store task is being used.intgetPriority()The priority of this jobvoidprocess()Processes the disk jobStringtoString()
-
-
-
Constructor Detail
-
DiskJobWriteBlock
public DiskJobWriteBlock(Piece piece, int blockIndex, byte[] data, Consumer<DiskJobWriteBlock> callback)
Creates a new job to store a block of a piece.- Parameters:
piece- The piece in which this block is foundblockIndex- The index of the block within the given piece.data- The bytes to write for the blockcallback- The callback which gets called on completion of this job
-
-
Method Detail
-
process
public void process() throws IOExceptionDescription copied from interface:IDiskJobProcesses the disk job- Specified by:
processin interfaceIDiskJob- Throws:
IOException
-
getPiece
public Piece getPiece()
Gets the piece for which this store task is being used.- Returns:
- The piece for which a block is/was being written.
-
getBlockIndex
public int getBlockIndex()
Gets the block index within the owning piece.- Returns:
- The index of the block within the piece.
- See Also:
getPiece()
-
getPriority
public int getPriority()
The priority of this job- Specified by:
getPriorityin interfaceIDiskJob- Returns:
- The priority
-
-