Package com.ning.http.client.generators
Class FileBodyGenerator
java.lang.Object
com.ning.http.client.generators.FileBodyGenerator
- All Implemented Interfaces:
BodyGenerator
Creates a request body from the contents of a file.
Beware, Netty provider has its own way for uploading files and won't use the BodyGenerator API.
If you want to use Netty and have a custom behavior while uploading a file through BodyGenerator,
implement BodyGenerator instead of extending FileBodyGenerator.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionFileBodyGenerator(File file) FileBodyGenerator(File file, long regionSeek, long regionLength) -
Method Summary
Modifier and TypeMethodDescriptionCreates a new instance of the request body to be read.getFile()longlong
-
Constructor Details
-
FileBodyGenerator
-
FileBodyGenerator
-
-
Method Details
-
createBody
Description copied from interface:BodyGeneratorCreates 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:
createBodyin interfaceBodyGenerator- Returns:
- The request body, never
null. - Throws:
IOException- If the body could not be created.
-
getFile
-
getRegionSeek
public long getRegionSeek() -
getRegionLength
public long getRegionLength()
-