im.yixin.sdk.http.multipart
类 Part

java.lang.Object
  继承者 im.yixin.sdk.http.multipart.Part
直接已知子类:
PartBase

public abstract class Part
extends java.lang.Object

Abstract class for one Part of a multipart post object.

从以下版本开始:
2.0

字段摘要
protected static java.lang.String BOUNDARY
          已过时。 use org.apache.http.client.methods.multipart#MULTIPART_BOUNDARY
protected static byte[] BOUNDARY_BYTES
          已过时。  
protected static java.lang.String CHARSET
          Content charset
protected static byte[] CHARSET_BYTES
          Content charset as a byte array
protected static java.lang.String CONTENT_DISPOSITION
          Content dispostion characters
protected static byte[] CONTENT_DISPOSITION_BYTES
          Content dispostion as a byte array
protected static java.lang.String CONTENT_TRANSFER_ENCODING
          Content type header
protected static byte[] CONTENT_TRANSFER_ENCODING_BYTES
          Content type header as a byte array
protected static java.lang.String CONTENT_TYPE
          Content type header
protected static byte[] CONTENT_TYPE_BYTES
          Content type header as a byte array
protected static java.lang.String CRLF
          Carriage return/linefeed
protected static byte[] CRLF_BYTES
          Carriage return/linefeed as a byte array
protected static java.lang.String EXTRA
          Extra characters
protected static byte[] EXTRA_BYTES
          Extra characters as a byte array
protected static java.lang.String QUOTE
          Content dispostion characters
protected static byte[] QUOTE_BYTES
          Content dispostion as a byte array
 
构造方法摘要
Part()
           
 
方法摘要
static java.lang.String getBoundary()
          已过时。 uses a constant string. Rather use getPartBoundary()
abstract  java.lang.String getCharSet()
          Return the character encoding of this part.
abstract  java.lang.String getContentType()
          Returns the content type of this part.
static long getLengthOfParts(Part[] parts)
          Return the total sum of all parts and that of the last boundary
static long getLengthOfParts(Part[] parts, byte[] partBoundary)
          Gets the length of the multipart message including the given parts.
abstract  java.lang.String getName()
          Return the name of this part.
protected  byte[] getPartBoundary()
          Gets the part boundary to be used.
abstract  java.lang.String getTransferEncoding()
          Return the transfer encoding of this part.
 boolean isRepeatable()
          Tests if this part can be sent more than once.
 long length()
          Return the full length of all the data.
protected abstract  long lengthOfData()
          Return the length of the main content
 void send(java.io.OutputStream out)
          Write all the data to the output stream.
protected  void sendContentTypeHeader(java.io.OutputStream out)
          Write the content type header to the specified output stream
protected abstract  void sendData(java.io.OutputStream out)
          Write the data to the specified output stream
protected  void sendDispositionHeader(java.io.OutputStream out)
          Write the content disposition header to the specified output stream
protected  void sendEnd(java.io.OutputStream out)
          Write the end data to the output stream.
protected  void sendEndOfHeader(java.io.OutputStream out)
          Write the end of the header to the output stream
static void sendParts(java.io.OutputStream out, Part[] parts)
          Write all parts and the last boundary to the specified output stream.
static void sendParts(java.io.OutputStream out, Part[] parts, byte[] partBoundary)
          Write all parts and the last boundary to the specified output stream.
protected  void sendStart(java.io.OutputStream out)
          Write the start to the specified output stream
protected  void sendTransferEncodingHeader(java.io.OutputStream out)
          Write the content transfer encoding header to the specified output stream
 java.lang.String toString()
          Return a string representation of this object.
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

字段详细信息

BOUNDARY

protected static final java.lang.String BOUNDARY
已过时。 use org.apache.http.client.methods.multipart#MULTIPART_BOUNDARY
The boundary

另请参见:
常量字段值

BOUNDARY_BYTES

protected static final byte[] BOUNDARY_BYTES
已过时。 
The boundary as a byte array.


CRLF

protected static final java.lang.String CRLF
Carriage return/linefeed

另请参见:
常量字段值

CRLF_BYTES

protected static final byte[] CRLF_BYTES
Carriage return/linefeed as a byte array


QUOTE

protected static final java.lang.String QUOTE
Content dispostion characters

另请参见:
常量字段值

QUOTE_BYTES

protected static final byte[] QUOTE_BYTES
Content dispostion as a byte array


EXTRA

protected static final java.lang.String EXTRA
Extra characters

另请参见:
常量字段值

EXTRA_BYTES

protected static final byte[] EXTRA_BYTES
Extra characters as a byte array


CONTENT_DISPOSITION

protected static final java.lang.String CONTENT_DISPOSITION
Content dispostion characters

另请参见:
常量字段值

CONTENT_DISPOSITION_BYTES

protected static final byte[] CONTENT_DISPOSITION_BYTES
Content dispostion as a byte array


CONTENT_TYPE

protected static final java.lang.String CONTENT_TYPE
Content type header

另请参见:
常量字段值

CONTENT_TYPE_BYTES

protected static final byte[] CONTENT_TYPE_BYTES
Content type header as a byte array


CHARSET

protected static final java.lang.String CHARSET
Content charset

另请参见:
常量字段值

CHARSET_BYTES

protected static final byte[] CHARSET_BYTES
Content charset as a byte array


CONTENT_TRANSFER_ENCODING

protected static final java.lang.String CONTENT_TRANSFER_ENCODING
Content type header

另请参见:
常量字段值

CONTENT_TRANSFER_ENCODING_BYTES

protected static final byte[] CONTENT_TRANSFER_ENCODING_BYTES
Content type header as a byte array

构造方法详细信息

Part

public Part()
方法详细信息

getBoundary

public static java.lang.String getBoundary()
已过时。 uses a constant string. Rather use getPartBoundary()

Return the boundary string.

返回:
the boundary string

getName

public abstract java.lang.String getName()
Return the name of this part.

返回:
The name.

getContentType

public abstract java.lang.String getContentType()
Returns the content type of this part.

返回:
the content type, or null to exclude the content type header

getCharSet

public abstract java.lang.String getCharSet()
Return the character encoding of this part.

返回:
the character encoding, or null to exclude the character encoding header

getTransferEncoding

public abstract java.lang.String getTransferEncoding()
Return the transfer encoding of this part.

返回:
the transfer encoding, or null to exclude the transfer encoding header

getPartBoundary

protected byte[] getPartBoundary()
Gets the part boundary to be used.

返回:
the part boundary as an array of bytes.
从以下版本开始:
3.0

isRepeatable

public boolean isRepeatable()
Tests if this part can be sent more than once.

返回:
true if sendData(OutputStream) can be successfully called more than once.
从以下版本开始:
3.0

sendStart

protected void sendStart(java.io.OutputStream out)
                  throws java.io.IOException
Write the start to the specified output stream

参数:
out - The output stream
抛出:
java.io.IOException - If an IO problem occurs.

sendDispositionHeader

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

参数:
out - The output stream
抛出:
java.io.IOException - If an IO problem occurs.

sendContentTypeHeader

protected void sendContentTypeHeader(java.io.OutputStream out)
                              throws java.io.IOException
Write the content type header to the specified output stream

参数:
out - The output stream
抛出:
java.io.IOException - If an IO problem occurs.

sendTransferEncodingHeader

protected void sendTransferEncodingHeader(java.io.OutputStream out)
                                   throws java.io.IOException
Write the content transfer encoding header to the specified output stream

参数:
out - The output stream
抛出:
java.io.IOException - If an IO problem occurs.

sendEndOfHeader

protected void sendEndOfHeader(java.io.OutputStream out)
                        throws java.io.IOException
Write the end of the header to the output stream

参数:
out - The output stream
抛出:
java.io.IOException - If an IO problem occurs.

sendData

protected abstract void sendData(java.io.OutputStream out)
                          throws java.io.IOException
Write the data to the specified output stream

参数:
out - The output stream
抛出:
java.io.IOException - If an IO problem occurs.

lengthOfData

protected abstract long lengthOfData()
                              throws java.io.IOException
Return the length of the main content

返回:
long The length.
抛出:
java.io.IOException - If an IO problem occurs

sendEnd

protected void sendEnd(java.io.OutputStream out)
                throws java.io.IOException
Write the end data to the output stream.

参数:
out - The output stream
抛出:
java.io.IOException - If an IO problem occurs.

send

public void send(java.io.OutputStream out)
          throws java.io.IOException
Write all the data to the output stream. If you override this method make sure to override #length() as well

参数:
out - The output stream
抛出:
java.io.IOException - If an IO problem occurs.

length

public long length()
            throws java.io.IOException
Return the full length of all the data. If you override this method make sure to override #send(OutputStream) as well

返回:
long The length.
抛出:
java.io.IOException - If an IO problem occurs

toString

public java.lang.String toString()
Return a string representation of this object.

覆盖:
java.lang.Object 中的 toString
返回:
A string representation of this object.
另请参见:
Object.toString()

sendParts

public static void sendParts(java.io.OutputStream out,
                             Part[] parts)
                      throws java.io.IOException
Write all parts and the last boundary to the specified output stream.

参数:
out - The stream to write to.
parts - The parts to write.
抛出:
java.io.IOException - If an I/O error occurs while writing the parts.

sendParts

public static void sendParts(java.io.OutputStream out,
                             Part[] parts,
                             byte[] partBoundary)
                      throws java.io.IOException
Write all parts and the last boundary to the specified output stream.

参数:
out - The stream to write to.
parts - The parts to write.
partBoundary - The ASCII bytes to use as the part boundary.
抛出:
java.io.IOException - If an I/O error occurs while writing the parts.
从以下版本开始:
3.0

getLengthOfParts

public static long getLengthOfParts(Part[] parts)
                             throws java.io.IOException
Return the total sum of all parts and that of the last boundary

参数:
parts - The parts.
返回:
The total length
抛出:
java.io.IOException - If an I/O error occurs while writing the parts.

getLengthOfParts

public static long getLengthOfParts(Part[] parts,
                                    byte[] partBoundary)
                             throws java.io.IOException
Gets the length of the multipart message including the given parts.

参数:
parts - The parts.
partBoundary - The ASCII bytes to use as the part boundary.
返回:
The total length
抛出:
java.io.IOException - If an I/O error occurs while writing the parts.
从以下版本开始:
3.0