|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ning.http.multipart.Part
public abstract class Part
This class is an adaptation of the Apache HttpClient implementation
Field Summary | |
---|---|
protected static java.lang.String |
BOUNDARY
The boundary |
protected static java.lang.String |
CHARSET
Content charset |
protected static java.lang.String |
CONTENT_DISPOSITION
Content dispostion characters |
protected static java.lang.String |
CONTENT_TRANSFER_ENCODING
Content type header |
protected static java.lang.String |
CONTENT_TYPE
Content type header |
protected static java.lang.String |
CRLF
Carriage return/linefeed |
protected static java.lang.String |
EXTRA
Extra characters |
protected static java.lang.String |
QUOTE
Content dispostion characters |
Constructor Summary | |
---|---|
Part()
|
Method Summary | |
---|---|
static java.lang.String |
getBoundary()
Deprecated. 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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final java.lang.String BOUNDARY
protected static final java.lang.String CRLF
protected static final java.lang.String QUOTE
protected static final java.lang.String EXTRA
protected static final java.lang.String CONTENT_DISPOSITION
protected static final java.lang.String CONTENT_TYPE
protected static final java.lang.String CHARSET
protected static final java.lang.String CONTENT_TRANSFER_ENCODING
Constructor Detail |
---|
public Part()
Method Detail |
---|
public static java.lang.String getBoundary()
getPartBoundary()
public abstract java.lang.String getName()
public abstract java.lang.String getContentType()
null
to exclude the content type headerpublic abstract java.lang.String getCharSet()
null
to exclude the character
encoding headerpublic abstract java.lang.String getTransferEncoding()
null
to exclude the transfer encoding headerprotected byte[] getPartBoundary()
public boolean isRepeatable()
true
if sendData(java.io.OutputStream)
can be successfully called
more than once.protected void sendStart(java.io.OutputStream out) throws java.io.IOException
out
- The output stream
java.io.IOException
- If an IO problem occurs.protected void sendDispositionHeader(java.io.OutputStream out) throws java.io.IOException
out
- The output stream
java.io.IOException
- If an IO problem occurs.protected void sendContentTypeHeader(java.io.OutputStream out) throws java.io.IOException
out
- The output stream
java.io.IOException
- If an IO problem occurs.protected void sendTransferEncodingHeader(java.io.OutputStream out) throws java.io.IOException
out
- The output stream
java.io.IOException
- If an IO problem occurs.protected void sendEndOfHeader(java.io.OutputStream out) throws java.io.IOException
out
- The output stream
java.io.IOException
- If an IO problem occurs.protected abstract void sendData(java.io.OutputStream out) throws java.io.IOException
out
- The output stream
java.io.IOException
- If an IO problem occurs.protected abstract long lengthOfData() throws java.io.IOException
java.io.IOException
- If an IO problem occursprotected void sendEnd(java.io.OutputStream out) throws java.io.IOException
out
- The output stream
java.io.IOException
- If an IO problem occurs.public void send(java.io.OutputStream out) throws java.io.IOException
out
- The output stream
java.io.IOException
- If an IO problem occurs.public long length() throws java.io.IOException
java.io.IOException
- If an IO problem occurspublic java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
public static void sendParts(java.io.OutputStream out, Part[] parts) throws java.io.IOException
out
- The stream to write to.parts
- The parts to write.
java.io.IOException
- If an I/O error occurs while writing the parts.public static void sendParts(java.io.OutputStream out, Part[] parts, byte[] partBoundary) throws java.io.IOException
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.public static long getLengthOfParts(Part[] parts) throws java.io.IOException
parts
- The parts.
java.io.IOException
- If an I/O error occurs while writing the parts.public static long getLengthOfParts(Part[] parts, byte[] partBoundary) throws java.io.IOException
parts
- The parts.partBoundary
- The ASCII bytes to use as the part boundary.
java.io.IOException
- If an I/O error occurs while writing the parts.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |