/** * Determines the MIME character set encoding of this <code>Entity</code>. * * @return the MIME character set encoding. */ public String getCharset() { return calcCharset((ContentTypeField) getHeader().getField(FieldName.CONTENT_TYPE)); }
public String getMimeType() { ContentTypeField childType = getContentTypeField(); Entity parent = getParent(); ContentTypeField parentType = parent != null ? (ContentTypeField) (parent).getHeader().getField(FieldName.CONTENT_TYPE) : null; return calcMimeType(childType, parentType); }
/** * Determines the transfer encoding of this <code>Entity</code>. * * @return the transfer encoding. */ public String getContentTransferEncoding() { ContentTransferEncodingField f = (ContentTransferEncodingField) getHeader().getField(FieldName.CONTENT_TRANSFER_ENCODING); return calcTransferEncoding(f); }
/** * Determines if the MIME type of this <code>Entity</code> is * <code>multipart/*</code>. Since multipart-entities must have * a boundary parameter in the <code>Content-Type</code> field this * method returns <code>false</code> if no boundary exists. * * @return <code>true</code> on match, <code>false</code> otherwise. */ public boolean isMultipart() { ContentTypeField f = getContentTypeField(); return f != null && f.getBoundary() != null && getMimeType().startsWith( ContentTypeField.TYPE_MULTIPART_PREFIX); }
/** * Return the disposition type of the content disposition of this * <code>Entity</code>. * * @return the disposition type or <code>null</code> if no disposition * type has been set. */ public String getDispositionType() { ContentDispositionField field = obtainField(FieldName.CONTENT_DISPOSITION); if (field == null) return null; return field.getDispositionType(); }
private ContentTypeField getContentTypeField() { return (ContentTypeField) getHeader().getField(FieldName.CONTENT_TYPE); }
/** * Returns the filename parameter of the content disposition of this * <code>Entity</code>. * * @return the filename parameter of the content disposition or * <code>null</code> if the filename has not been set. */ public String getFilename() { ContentDispositionField field = obtainField(FieldName.CONTENT_DISPOSITION); if (field == null) return null; return field.getFilename(); }
/** * Obtains the header field with the specified name. * * @param <F> * concrete field type. * @param fieldName * name of the field to retrieve. * @return the header field or <code>null</code> if this entity has no * header or the header contains no such field. */ <F extends ParsedField> F obtainField(String fieldName) { Header header = getHeader(); if (header == null) return null; return (F) header.getField(fieldName); }