Class AbstractContentBody
java.lang.Object
org.apache.hc.client5.http.entity.mime.AbstractContentBody
- All Implemented Interfaces:
ContentBody, ContentDescriptor
- Direct Known Subclasses:
ByteArrayBody, FileBody, InputStreamBody, StringBody
- Since:
- 4.0
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionThe body descriptors character set, defaulted appropriately for the MIME type.org.apache.hc.core5.http.ContentTypeGets the defaulted MIME media type for this content.Returns the body descriptors MIME type.Gets the defaulted MIME sub type for this content.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ContentBody
getFilename, writeToMethods inherited from interface ContentDescriptor
getContentLength
-
Field Details
-
contentType
private final org.apache.hc.core5.http.ContentType contentType
-
-
Constructor Details
-
AbstractContentBody
public AbstractContentBody(org.apache.hc.core5.http.ContentType contentType) - Since:
- 4.3
-
-
Method Details
-
getContentType
public org.apache.hc.core5.http.ContentType getContentType()- Since:
- 4.3
-
getMimeType
Description copied from interface:ContentDescriptorReturns the body descriptors MIME type.- Specified by:
getMimeTypein interfaceContentDescriptor- Returns:
- The MIME type, which has been parsed from the content-type definition. Must not be null, but "text/plain", if no content-type was specified.
- See Also:
-
getMediaType
Description copied from interface:ContentDescriptorGets the defaulted MIME media type for this content. For exampleTEXT,IMAGE,MULTIPART- Specified by:
getMediaTypein interfaceContentDescriptor- Returns:
- the MIME media type when content-type specified,
otherwise the correct default (
TEXT) - See Also:
-
getSubType
Description copied from interface:ContentDescriptorGets the defaulted MIME sub type for this content.- Specified by:
getSubTypein interfaceContentDescriptor- Returns:
- the MIME media type when content-type is specified,
otherwise the correct default (
PLAIN) - See Also:
-
getCharset
Description copied from interface:ContentDescriptorThe body descriptors character set, defaulted appropriately for the MIME type.
For
TEXTtypes, this will be defaulted tous-ascii. For other types, when the charset parameter is missing this property will be null.- Specified by:
getCharsetin interfaceContentDescriptor- Returns:
- Character set, which has been parsed from the
content-type definition. Not null for
TEXTtypes, when unset will be set to defaultus-ascii. For other types, when unset, null will be returned.
-