Class FileBody
java.lang.Object
org.apache.http.entity.mime.content.AbstractContentBody
org.apache.http.entity.mime.content.FileBody
- All Implemented Interfaces:
ContentBody
,ContentDescriptor
Binary body part backed by a file.
- Since:
- 4.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.Deprecated.(4.3) useFileBody(File, ContentType)
orMultipartEntityBuilder
Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionlong
Returns the body descriptors content-length.getFile()
Returns the body descriptors transfer encoding.void
writeTo
(OutputStream out) Methods inherited from class org.apache.http.entity.mime.content.AbstractContentBody
getCharset, getContentType, getMediaType, getMimeType, getSubType
-
Constructor Details
-
FileBody
Deprecated.- Since:
- 4.1
-
FileBody
Deprecated.(4.3) useFileBody(File, ContentType)
orMultipartEntityBuilder
- Since:
- 4.1
-
FileBody
Deprecated.(4.3) useFileBody(File, ContentType)
orMultipartEntityBuilder
-
FileBody
-
FileBody
- Since:
- 4.3
-
FileBody
- Since:
- 4.3
-
-
Method Details
-
getInputStream
- Throws:
IOException
-
writeTo
- Throws:
IOException
-
getTransferEncoding
Description copied from interface:ContentDescriptor
Returns the body descriptors transfer encoding.- Returns:
- The transfer encoding. Must not be null, but "7bit", if no transfer-encoding was specified.
-
getContentLength
public long getContentLength()Description copied from interface:ContentDescriptor
Returns the body descriptors content-length.- Returns:
- Content length, if known, or -1, to indicate the absence of a content-length header.
-
getFilename
-
getFile
-
FileBody(File, ContentType)
orMultipartEntityBuilder