com.ning.http.client.consumers
Class FileBodyConsumer

java.lang.Object
  extended by com.ning.http.client.consumers.FileBodyConsumer
All Implemented Interfaces:
BodyConsumer, ResumableBodyConsumer

public class FileBodyConsumer
extends Object
implements ResumableBodyConsumer

A RandomAccessFile that can be used as a ResumableBodyConsumer


Constructor Summary
FileBodyConsumer(RandomAccessFile file)
           
 
Method Summary
 void close()
          Invoked when all the response bytes has been processed.
 void consume(ByteBuffer byteBuffer)
          Consume the received bytes.
 long getTransferredBytes()
          Get the previously transferred bytes, for example the current file size.
 void resume()
          Prepare this consumer to resume a download, for example by seeking to the end of the underlying file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileBodyConsumer

public FileBodyConsumer(RandomAccessFile file)
Method Detail

consume

public void consume(ByteBuffer byteBuffer)
             throws IOException
Consume the received bytes.

Specified by:
consume in interface BodyConsumer
Parameters:
byteBuffer - a ByteBuffer represntation of the response's chunk.
Throws:
IOException

close

public void close()
           throws IOException
Invoked when all the response bytes has been processed.

Specified by:
close in interface BodyConsumer
Throws:
IOException

getTransferredBytes

public long getTransferredBytes()
                         throws IOException
Get the previously transferred bytes, for example the current file size.

Specified by:
getTransferredBytes in interface ResumableBodyConsumer
Throws:
IOException

resume

public void resume()
            throws IOException
Prepare this consumer to resume a download, for example by seeking to the end of the underlying file.

Specified by:
resume in interface ResumableBodyConsumer
Throws:
IOException


Copyright © 2014. All Rights Reserved.