Class Part
java.lang.Object
edu.internet2.middleware.grouperClientExt.org.apache.commons.httpclient.methods.multipart.Part
- Direct Known Subclasses:
PartBase
Abstract class for one Part of a multipart post object.
- Since:
- 2.0
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final String
Deprecated.protected static final byte[]
Deprecated.protected static final String
Content charsetprotected static final byte[]
Content charset as a byte arrayprotected static final String
Content dispostion charactersprotected static final byte[]
Content dispostion as a byte arrayprotected static final String
Content type headerprotected static final byte[]
Content type header as a byte arrayprotected static final String
Content type headerprotected static final byte[]
Content type header as a byte arrayprotected static final String
Carriage return/linefeedprotected static final byte[]
Carriage return/linefeed as a byte arrayprotected static final String
Extra charactersprotected static final byte[]
Extra characters as a byte arrayprotected static final String
Content dispostion charactersprotected static final byte[]
Content dispostion as a byte array -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
Deprecated.uses a constant string.abstract String
Return the character encoding of this part.abstract String
Returns the content type of this part.static long
getLengthOfParts
(Part[] parts) Return the total sum of all parts and that of the last boundarystatic long
getLengthOfParts
(Part[] parts, byte[] partBoundary) Gets the length of the multipart message including the given parts.abstract String
getName()
Return the name of this part.protected byte[]
Gets the part boundary to be used.abstract String
Return the transfer encoding of this part.boolean
Tests if this part can be sent more than once.long
length()
Return the full length of all the data.protected abstract long
Return the length of the main contentvoid
send
(OutputStream out) Write all the data to the output stream.protected void
Write the content type header to the specified output streamprotected abstract void
sendData
(OutputStream out) Write the data to the specified output streamprotected void
Write the content disposition header to the specified output streamprotected void
sendEnd
(OutputStream out) Write the end data to the output stream.protected void
Write the end of the header to the output streamstatic void
sendParts
(OutputStream out, Part[] parts) Write all parts and the last boundary to the specified output stream.static void
sendParts
(OutputStream out, Part[] parts, byte[] partBoundary) Write all parts and the last boundary to the specified output stream.protected void
sendStart
(OutputStream out) Write the start to the specified output streamprotected void
Write the content transfer encoding header to the specified output streamtoString()
Return a string representation of this object.
-
Field Details
-
BOUNDARY
Deprecated.The boundary- See Also:
-
BOUNDARY_BYTES
protected static final byte[] BOUNDARY_BYTESDeprecated.The boundary as a byte array. -
CRLF
Carriage return/linefeed- See Also:
-
CRLF_BYTES
protected static final byte[] CRLF_BYTESCarriage return/linefeed as a byte array -
QUOTE
Content dispostion characters- See Also:
-
QUOTE_BYTES
protected static final byte[] QUOTE_BYTESContent dispostion as a byte array -
EXTRA
Extra characters- See Also:
-
EXTRA_BYTES
protected static final byte[] EXTRA_BYTESExtra characters as a byte array -
CONTENT_DISPOSITION
Content dispostion characters- See Also:
-
CONTENT_DISPOSITION_BYTES
protected static final byte[] CONTENT_DISPOSITION_BYTESContent dispostion as a byte array -
CONTENT_TYPE
Content type header- See Also:
-
CONTENT_TYPE_BYTES
protected static final byte[] CONTENT_TYPE_BYTESContent type header as a byte array -
CHARSET
Content charset- See Also:
-
CHARSET_BYTES
protected static final byte[] CHARSET_BYTESContent charset as a byte array -
CONTENT_TRANSFER_ENCODING
Content type header- See Also:
-
CONTENT_TRANSFER_ENCODING_BYTES
protected static final byte[] CONTENT_TRANSFER_ENCODING_BYTESContent type header as a byte array
-
-
Constructor Details
-
Part
public Part()
-
-
Method Details
-
getBoundary
Deprecated.uses a constant string. Rather usegetPartBoundary()
Return the boundary string.- Returns:
- the boundary string
-
getName
Return the name of this part.- Returns:
- The name.
-
getContentType
Returns the content type of this part.- Returns:
- the content type, or
null
to exclude the content type header
-
getCharSet
Return the character encoding of this part.- Returns:
- the character encoding, or
null
to exclude the character encoding header
-
getTransferEncoding
Return the transfer encoding of this part.- Returns:
- the transfer encoding, or
null
to exclude the transfer encoding header
-
getPartBoundary
protected byte[] getPartBoundary()Gets the part boundary to be used.- Returns:
- the part boundary as an array of bytes.
- Since:
- 3.0
-
isRepeatable
public boolean isRepeatable()Tests if this part can be sent more than once.- Returns:
true
ifsendData(OutputStream)
can be successfully called more than once.- Since:
- 3.0
-
sendStart
Write the start to the specified output stream- Parameters:
out
- The output stream- Throws:
IOException
- If an IO problem occurs.
-
sendDispositionHeader
Write the content disposition header to the specified output stream- Parameters:
out
- The output stream- Throws:
IOException
- If an IO problem occurs.
-
sendContentTypeHeader
Write the content type header to the specified output stream- Parameters:
out
- The output stream- Throws:
IOException
- If an IO problem occurs.
-
sendTransferEncodingHeader
Write the content transfer encoding header to the specified output stream- Parameters:
out
- The output stream- Throws:
IOException
- If an IO problem occurs.
-
sendEndOfHeader
Write the end of the header to the output stream- Parameters:
out
- The output stream- Throws:
IOException
- If an IO problem occurs.
-
sendData
Write the data to the specified output stream- Parameters:
out
- The output stream- Throws:
IOException
- If an IO problem occurs.
-
lengthOfData
Return the length of the main content- Returns:
- long The length.
- Throws:
IOException
- If an IO problem occurs
-
sendEnd
Write the end data to the output stream.- Parameters:
out
- The output stream- Throws:
IOException
- If an IO problem occurs.
-
send
Write all the data to the output stream. If you override this method make sure to override #length() as well- Parameters:
out
- The output stream- Throws:
IOException
- If an IO problem occurs.
-
length
Return the full length of all the data. If you override this method make sure to override #send(OutputStream) as well- Returns:
- long The length.
- Throws:
IOException
- If an IO problem occurs
-
toString
Return a string representation of this object. -
sendParts
Write all parts and the last boundary to the specified output stream.- Parameters:
out
- The stream to write to.parts
- The parts to write.- Throws:
IOException
- If an I/O error occurs while writing the parts.
-
sendParts
public static void sendParts(OutputStream out, Part[] parts, byte[] partBoundary) throws IOException Write all parts and the last boundary to the specified output stream.- Parameters:
out
- The stream to write to.parts
- The parts to write.partBoundary
- The ASCII bytes to use as the part boundary.- Throws:
IOException
- If an I/O error occurs while writing the parts.- Since:
- 3.0
-
getLengthOfParts
Return the total sum of all parts and that of the last boundary- Parameters:
parts
- The parts.- Returns:
- The total length
- Throws:
IOException
- If an I/O error occurs while writing the parts.
-
getLengthOfParts
Gets the length of the multipart message including the given parts.- Parameters:
parts
- The parts.partBoundary
- The ASCII bytes to use as the part boundary.- Returns:
- The total length
- Throws:
IOException
- If an I/O error occurs while writing the parts.- Since:
- 3.0
-
HttpMethodParams.MULTIPART_BOUNDARY