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