Methods Summary |
---|
protected void | cancel()
for (int i=0;i<requests.size();i++){
PeerReadRequest req = (PeerReadRequest)requests.get(i);
if ( !req.isCancelled()){
req.cancel();
}
}
|
public void | done()
reader.informComplete( current_request, current_buffer );
|
public void | failed()
for (int i=current_request_index;i<requests.size();i++){
PeerReadRequest request = (PeerReadRequest)requests.get(i);
reader.informFailed( request );
}
|
public byte[] | getBuffer()
if ( current_request_index >= requests.size()){
throw( new ExternalSeedException( "Insufficient buffers to satisfy request" ));
}
current_request = (PeerReadRequest)requests.get(current_request_index++);
current_buffer = new byte[ current_request.getLength()];
current_position = 0;
return( current_buffer );
|
public int | getBufferLength()
return( current_buffer.length );
|
public int | getBufferPosition()
return( current_position );
|
public int | getLength()
return( length );
|
public int | getPercentDoneOfCurrentIncomingRequest()
PeerReadRequest req = current_request;
if ( req == null ){
return( 0 );
}
return(( 100 * current_position ) / req.getLength() );
|
public int | getPermittedBytes()
PeerReadRequest req = current_request;
if ( req == null ){
req = (PeerReadRequest)requests.get(0);
}
if ( req.isCancelled()){
throw( new ExternalSeedException( "Request cancelled" ));
}
return( reader.getPermittedBytes());
|
public int | getStartPieceNumber()
return( start_piece_number );
|
public int | getStartPieceOffset()
return( start_piece_offset );
|
public void | reportBytesRead(int num)
reader.reportBytesRead( num );
|
public void | setBufferPosition(int pos)
current_position = pos;
|