Class FileBody
- java.lang.Object
 - 
- org.apache.http.entity.mime.content.AbstractContentBody
 - 
- org.apache.http.entity.mime.content.FileBody
 
 
 
- 
- All Implemented Interfaces:
 ContentBody,ContentDescriptor
public class FileBody extends AbstractContentBody
Binary body part backed by a file.- Since:
 - 4.0
 - See Also:
 MultipartEntityBuilder
 
- 
- 
Constructor Summary
Constructors Constructor Description FileBody(java.io.File file)FileBody(java.io.File file, java.lang.String mimeType)Deprecated.(4.3) useFileBody(File, ContentType)orMultipartEntityBuilderFileBody(java.io.File file, java.lang.String mimeType, java.lang.String charset)Deprecated.(4.3) useFileBody(File, ContentType)orMultipartEntityBuilderFileBody(java.io.File file, java.lang.String filename, java.lang.String mimeType, java.lang.String charset)Deprecated.FileBody(java.io.File file, ContentType contentType)FileBody(java.io.File file, ContentType contentType, java.lang.String filename) 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetContentLength()Returns the body descriptors content-length.java.io.FilegetFile()java.lang.StringgetFilename()java.io.InputStreamgetInputStream()java.lang.StringgetTransferEncoding()Returns the body descriptors transfer encoding.voidwriteTo(java.io.OutputStream out)- 
Methods inherited from class org.apache.http.entity.mime.content.AbstractContentBody
getCharset, getContentType, getMediaType, getMimeType, getSubType 
 - 
 
 - 
 
- 
- 
Constructor Detail
- 
FileBody
@Deprecated public FileBody(java.io.File file, java.lang.String filename, java.lang.String mimeType, java.lang.String charset)Deprecated.- Since:
 - 4.1
 
 
- 
FileBody
@Deprecated public FileBody(java.io.File file, java.lang.String mimeType, java.lang.String charset)Deprecated.(4.3) useFileBody(File, ContentType)orMultipartEntityBuilder- Since:
 - 4.1
 
 
- 
FileBody
@Deprecated public FileBody(java.io.File file, java.lang.String mimeType)Deprecated.(4.3) useFileBody(File, ContentType)orMultipartEntityBuilder 
- 
FileBody
public FileBody(java.io.File file)
 
- 
FileBody
public FileBody(java.io.File file, ContentType contentType, java.lang.String filename)- Since:
 - 4.3
 
 
- 
FileBody
public FileBody(java.io.File file, ContentType contentType)- Since:
 - 4.3
 
 
 - 
 
- 
Method Detail
- 
getInputStream
public java.io.InputStream getInputStream() throws java.io.IOException- Throws:
 java.io.IOException
 
- 
writeTo
public void writeTo(java.io.OutputStream out) throws java.io.IOException- Throws:
 java.io.IOException
 
- 
getTransferEncoding
public java.lang.String getTransferEncoding()
Description copied from interface:ContentDescriptorReturns 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:ContentDescriptorReturns the body descriptors content-length.- Returns:
 - Content length, if known, or -1, to indicate the absence of a content-length header.
 
 
- 
getFilename
public java.lang.String getFilename()
 
- 
getFile
public java.io.File getFile()
 
 - 
 
 -