com.ning.http.client.generators
Class FileBodyGenerator

java.lang.Object
  extended by com.ning.http.client.generators.FileBodyGenerator
All Implemented Interfaces:
BodyGenerator

public class FileBodyGenerator
extends Object
implements BodyGenerator

Creates a request body from the contents of a file.


Nested Class Summary
protected static class FileBodyGenerator.FileBody
           
 
Constructor Summary
FileBodyGenerator(File file)
           
FileBodyGenerator(File file, long regionSeek, long regionLength)
           
 
Method Summary
 RandomAccessBody createBody()
          Creates a new instance of the request body to be read.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileBodyGenerator

public FileBodyGenerator(File file)

FileBodyGenerator

public FileBodyGenerator(File file,
                         long regionSeek,
                         long regionLength)
Method Detail

createBody

public RandomAccessBody createBody()
                            throws IOException
Description copied from interface: BodyGenerator
Creates a new instance of the request body to be read. While each invocation of this method is supposed to create a fresh instance of the body, the actual contents of all these body instances is the same. For example, the body needs to be resend after an authentication challenge of a redirect.

Specified by:
createBody in interface BodyGenerator
Returns:
The request body, never null.
Throws:
IOException - If the body could not be created.


Copyright © 2011. All Rights Reserved.