com.ning.http.client.extra
Class ResumableRandomAccessFileHandler

java.lang.Object
  extended by com.ning.http.client.extra.ResumableRandomAccessFileHandler
All Implemented Interfaces:
ResumableListener

public class ResumableRandomAccessFileHandler
extends Object
implements ResumableListener

A TransferListener which use a RandomAccessFile for storing the received bytes.


Constructor Summary
ResumableRandomAccessFileHandler(RandomAccessFile file)
           
 
Method Summary
 long length()
          Return the length of previously downloaded bytes.
 void onAllBytesReceived()
          Invoked when all the bytes has been sucessfully transferred.
 void onBytesReceived(ByteBuffer buffer)
          This method uses the last valid bytes written on disk to position a RandomAccessFile, allowing resumable file download.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResumableRandomAccessFileHandler

public ResumableRandomAccessFileHandler(RandomAccessFile file)
Method Detail

onBytesReceived

public void onBytesReceived(ByteBuffer buffer)
                     throws IOException
This method uses the last valid bytes written on disk to position a RandomAccessFile, allowing resumable file download.

Specified by:
onBytesReceived in interface ResumableListener
Parameters:
buffer - a ByteBuffer
Throws:
IOException

onAllBytesReceived

public void onAllBytesReceived()
Invoked when all the bytes has been sucessfully transferred.

Specified by:
onAllBytesReceived in interface ResumableListener

length

public long length()
Return the length of previously downloaded bytes.

Specified by:
length in interface ResumableListener
Returns:
the length of previously downloaded bytes


Copyright © 2010. All Rights Reserved.