Class ResumableRandomAccessFileListener
- java.lang.Object
-
- org.asynchttpclient.handler.resumable.ResumableRandomAccessFileListener
-
- All Implemented Interfaces:
ResumableListener
public class ResumableRandomAccessFileListener extends Object implements ResumableListener
AResumableListenerwhich use aRandomAccessFilefor storing the received bytes.
-
-
Constructor Summary
Constructors Constructor Description ResumableRandomAccessFileListener(RandomAccessFile file)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longlength()Return the length of previously downloaded bytes.voidonAllBytesReceived()Invoked when all the bytes has been successfully transferred.voidonBytesReceived(ByteBuffer buffer)This method uses the last valid bytes written on disk to position aRandomAccessFile, allowing resumable file download.
-
-
-
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 aRandomAccessFile, allowing resumable file download.- Specified by:
onBytesReceivedin interfaceResumableListener- Parameters:
buffer- aByteBuffer- Throws:
IOException- exception while writing into the file
-
onAllBytesReceived
public void onAllBytesReceived()
Description copied from interface:ResumableListenerInvoked when all the bytes has been successfully transferred.- Specified by:
onAllBytesReceivedin interfaceResumableListener
-
length
public long length()
Description copied from interface:ResumableListenerReturn the length of previously downloaded bytes.- Specified by:
lengthin interfaceResumableListener- Returns:
- the length of previously downloaded bytes
-
-