com.foxinmy.weixin4j.http.apache
Class FileBody
java.lang.Object
com.foxinmy.weixin4j.http.apache.AbstractContentBody
com.foxinmy.weixin4j.http.apache.FileBody
- All Implemented Interfaces:
- ContentBody, ContentDescriptor
public class FileBody
- extends AbstractContentBody
- Since:
- 4.0
FileBody
public FileBody(File file,
String filename,
String mimeType,
String charset)
- Since:
- 4.1
FileBody
public FileBody(File file,
String mimeType,
String charset)
- Since:
- 4.1
FileBody
public FileBody(File file,
String mimeType)
FileBody
public FileBody(File file)
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:
ContentDescriptor
- Returns the body descriptors transfer encoding.
- Returns:
- The transfer encoding. Must not be null, but "7bit",
if no transfer-encoding was specified.
getCharset
public String getCharset()
- Description copied from interface:
ContentDescriptor
The body descriptors character set, defaulted appropriately for the MIME type.
For TEXT types, this will be defaulted to us-ascii.
For other types, when the charset parameter is missing this property will be null.
- Returns:
- Character set, which has been parsed from the
content-type definition. Not null for
TEXT types, when unset will
be set to default us-ascii. For other types, when unset,
null will be returned.
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
public String getFilename()
getFile
public File getFile()
Copyright © 2014–2017. All rights reserved.