im.yixin.sdk.http.multipart
类 FilePart

java.lang.Object
  继承者 im.yixin.sdk.http.multipart.Part
      继承者 im.yixin.sdk.http.multipart.PartBase
          继承者 im.yixin.sdk.http.multipart.FilePart

public class FilePart
extends PartBase

This class implements a part of a Multipart post object that consists of a file.

从以下版本开始:
2.0

字段摘要
static java.lang.String DEFAULT_CHARSET
          Default charset of file attachments.
static java.lang.String DEFAULT_CONTENT_TYPE
          Default content encoding of file attachments.
static java.lang.String DEFAULT_TRANSFER_ENCODING
          Default transfer encoding of file attachments.
protected static java.lang.String FILE_NAME
          Attachment's file name
 
从类 im.yixin.sdk.http.multipart.Part 继承的字段
BOUNDARY, BOUNDARY_BYTES, CHARSET, CHARSET_BYTES, CONTENT_DISPOSITION, CONTENT_DISPOSITION_BYTES, CONTENT_TRANSFER_ENCODING, CONTENT_TRANSFER_ENCODING_BYTES, CONTENT_TYPE, CONTENT_TYPE_BYTES, CRLF, CRLF_BYTES, EXTRA, EXTRA_BYTES, QUOTE, QUOTE_BYTES
 
构造方法摘要
FilePart(java.lang.String name, PartSource partSource)
          FilePart Constructor.
FilePart(java.lang.String name, PartSource partSource, java.lang.String contentType, java.lang.String charset)
          FilePart Constructor.
FilePart(java.lang.String name, java.lang.String ofile, java.io.File file, java.lang.String contentType, java.lang.String charset)
          FilePart Constructor.
 
方法摘要
protected  PartSource getSource()
          Returns the source of the file part.
protected  long lengthOfData()
          Return the length of the data.
protected  void sendData(java.io.OutputStream out)
          Write the data in "source" to the specified stream.
protected  void sendDispositionHeader(java.io.OutputStream out)
          Write the disposition header to the output stream
 
从类 im.yixin.sdk.http.multipart.PartBase 继承的方法
getCharSet, getContentType, getName, getTransferEncoding, setCharSet, setContentType, setName, setTransferEncoding
 
从类 im.yixin.sdk.http.multipart.Part 继承的方法
getBoundary, getLengthOfParts, getLengthOfParts, getPartBoundary, isRepeatable, length, send, sendContentTypeHeader, sendEnd, sendEndOfHeader, sendParts, sendParts, sendStart, sendTransferEncodingHeader, toString
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

字段详细信息

DEFAULT_CONTENT_TYPE

public static final java.lang.String DEFAULT_CONTENT_TYPE
Default content encoding of file attachments.

另请参见:
常量字段值

DEFAULT_CHARSET

public static final java.lang.String DEFAULT_CHARSET
Default charset of file attachments.

另请参见:
常量字段值

DEFAULT_TRANSFER_ENCODING

public static final java.lang.String DEFAULT_TRANSFER_ENCODING
Default transfer encoding of file attachments.

另请参见:
常量字段值

FILE_NAME

protected static final java.lang.String FILE_NAME
Attachment's file name

另请参见:
常量字段值
构造方法详细信息

FilePart

public FilePart(java.lang.String name,
                PartSource partSource,
                java.lang.String contentType,
                java.lang.String charset)
FilePart Constructor.

参数:
name - the name for this part
partSource - the source for this part
contentType - the content type for this part, if null the default is used
charset - the charset encoding for this part, if null the default is used

FilePart

public FilePart(java.lang.String name,
                PartSource partSource)
FilePart Constructor.

参数:
name - the name for this part
partSource - the source for this part

FilePart

public FilePart(java.lang.String name,
                java.lang.String ofile,
                java.io.File file,
                java.lang.String contentType,
                java.lang.String charset)
         throws java.io.FileNotFoundException
FilePart Constructor.

参数:
name - the name of the file part
file - the file to post
contentType - the content type for this part, if null the default is used
charset - the charset encoding for this part, if null the default is used
抛出:
java.io.FileNotFoundException - if the file is not a normal file or if it is not readable.
方法详细信息

sendDispositionHeader

protected void sendDispositionHeader(java.io.OutputStream out)
                              throws java.io.IOException
Write the disposition header to the output stream

覆盖:
Part 中的 sendDispositionHeader
参数:
out - The output stream
抛出:
java.io.IOException - If an IO problem occurs
另请参见:
Part.sendDispositionHeader(OutputStream)

sendData

protected void sendData(java.io.OutputStream out)
                 throws java.io.IOException
Write the data in "source" to the specified stream.

指定者:
Part 中的 sendData
参数:
out - The output stream.
抛出:
java.io.IOException - if an IO problem occurs.
另请参见:
Part.sendData(OutputStream)

getSource

protected PartSource getSource()
Returns the source of the file part.

返回:
The source.

lengthOfData

protected long lengthOfData()
Return the length of the data.

指定者:
Part 中的 lengthOfData
返回:
The length.
另请参见:
Part.lengthOfData()