com.ning.http.client.extra
Class ResumableRandomAccessFileListener

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

public class ResumableRandomAccessFileListener
extends Object
implements ResumableListener

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


Constructor Summary
ResumableRandomAccessFileListener(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

ResumableRandomAccessFileListener

public ResumableRandomAccessFileListener(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 © 2011. All Rights Reserved.