本文整理汇总了Java中org.apache.http.entity.mime.content.ContentBody.getCharset方法的典型用法代码示例。如果您正苦于以下问题:Java ContentBody.getCharset方法的具体用法?Java ContentBody.getCharset怎么用?Java ContentBody.getCharset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.http.entity.mime.content.ContentBody
的用法示例。
在下文中一共展示了ContentBody.getCharset方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateContentType
import org.apache.http.entity.mime.content.ContentBody; //导入方法依赖的package包/类
/**
* @deprecated (4.4) use {@link org.apache.http.entity.mime.FormBodyPartBuilder}.
*/
@Deprecated
protected void generateContentType(final ContentBody body) {
final ContentType contentType;
if (body instanceof AbstractContentBody) {
contentType = ((AbstractContentBody) body).getContentType();
} else {
contentType = null;
}
if (contentType != null) {
addField(MIME.CONTENT_TYPE, contentType.toString());
} else {
final StringBuilder buffer = new StringBuilder();
buffer.append(body.getMimeType()); // MimeType cannot be null
if (body.getCharset() != null) { // charset may legitimately be null
buffer.append("; charset=");
buffer.append(body.getCharset());
}
addField(MIME.CONTENT_TYPE, buffer.toString());
}
}
示例2: generateContentType
import org.apache.http.entity.mime.content.ContentBody; //导入方法依赖的package包/类
protected void generateContentType(ContentBody body) {
StringBuilder buffer = new StringBuilder();
buffer.append(body.getMimeType());
if (body.getCharset() != null) {
buffer.append("; charset=");
buffer.append(body.getCharset());
}
addField("Content-Type", buffer.toString());
}
示例3: generateContentType
import org.apache.http.entity.mime.content.ContentBody; //导入方法依赖的package包/类
protected void generateContentType(final ContentBody body) {
StringBuilder buffer = new StringBuilder();
buffer.append(body.getMimeType()); // MimeType cannot be null
if (body.getCharset() != null) { // charset may legitimately be null
buffer.append("; charset=");
buffer.append(body.getCharset());
}
addField(MIME.CONTENT_TYPE, buffer.toString());
}