Package com.ning.http.client.multipart
Class PartBase
java.lang.Object
com.ning.http.client.multipart.PartBase
- All Implemented Interfaces:
Part
- Direct Known Subclasses:
AbstractFilePart,StringPart
-
Field Summary
FieldsFields inherited from interface com.ning.http.client.multipart.Part
CHARSET_BYTES, CONTENT_DISPOSITION_BYTES, CONTENT_ID_BYTES, CONTENT_TRANSFER_ENCODING_BYTES, CONTENT_TYPE_BYTES, CRLF_BYTES, EXTRA_BYTES, FORM_DATA_DISPOSITION_TYPE_BYTES, NAME_BYTES, QUOTE_BYTE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCustomHeader(String name, String value) Return the character encoding of this part.Return the content ID of this part.Returns the content type of this part.protected abstract longGets the disposition-type to be used in Content-Disposition headergetName()Return the name of this part.Return the transfer encoding of this part.longlength(byte[] boundary) Return the full length of all the data.protected abstract voidsendData(OutputStream out) voidsetCustomHeaders(List<Param> customHeaders) voidsetDispositionType(String dispositionType) toString()protected voidvisitContentIdHeader(PartVisitor visitor) protected voidvisitContentTypeHeader(PartVisitor visitor) protected voidvisitCustomHeaders(PartVisitor visitor) protected voidvisitDispositionHeader(PartVisitor visitor) protected voidvisitEnd(PartVisitor visitor) protected voidvisitEndOfHeaders(PartVisitor visitor) protected voidvisitStart(PartVisitor visitor, byte[] boundary) protected voidvisitTransferEncodingHeader(PartVisitor visitor) voidwrite(OutputStream out, byte[] boundary) Write all the data to the output stream.
-
Field Details
-
AHC_ALLOW_UTF8
- See Also:
-
HEADERS_CHARSET
-
-
Constructor Details
-
PartBase
-
PartBase
public PartBase(String name, String contentType, Charset charset, String contentId, String transferEncoding) Constructor.- Parameters:
name- The name of the part, ornullcontentType- The content type, ornullcharset- The character encoding, ornullcontentId- The content id, ornulltransferEncoding- The transfer encoding, ornull
-
-
Method Details
-
visitStart
- Throws:
IOException
-
visitDispositionHeader
- Throws:
IOException
-
visitContentTypeHeader
- Throws:
IOException
-
visitTransferEncodingHeader
- Throws:
IOException
-
visitContentIdHeader
- Throws:
IOException
-
visitCustomHeaders
- Throws:
IOException
-
visitEndOfHeaders
- Throws:
IOException
-
visitEnd
- Throws:
IOException
-
getDataLength
protected abstract long getDataLength() -
sendData
- Throws:
IOException
-
write
Write all the data to the output stream. If you override this method make sure to override #length() as well- Specified by:
writein interfacePart- Parameters:
out- The output streamboundary- the boundary- Throws:
IOException- If an IO problem occurs.
-
length
public long length(byte[] boundary) Return the full length of all the data. If you override this method make sure to override #send(OutputStream) as well -
toString
-
getName
Description copied from interface:PartReturn the name of this part. -
getContentType
Description copied from interface:PartReturns the content type of this part.- Specified by:
getContentTypein interfacePart- Returns:
- the content type, or
nullto exclude the content type header
-
getCharset
Description copied from interface:PartReturn the character encoding of this part.- Specified by:
getCharsetin interfacePart- Returns:
- the character encoding, or
nullto exclude the character encoding header
-
getTransferEncoding
Description copied from interface:PartReturn the transfer encoding of this part.- Specified by:
getTransferEncodingin interfacePart- Returns:
- the transfer encoding, or
nullto exclude the transfer encoding header
-
getContentId
Description copied from interface:PartReturn the content ID of this part.- Specified by:
getContentIdin interfacePart- Returns:
- the content ID, or
nullto exclude the content ID header
-
getDispositionType
Description copied from interface:PartGets the disposition-type to be used in Content-Disposition header- Specified by:
getDispositionTypein interfacePart- Returns:
- the disposition-type
-
setDispositionType
-
addCustomHeader
-
setCustomHeaders
-