org.archive.util
Class MimetypeUtils

java.lang.Object
  extended by org.archive.util.MimetypeUtils

public class MimetypeUtils
extends java.lang.Object

Class of mimetype utilities.

Author:
stack

Field Summary
static java.lang.String NO_TYPE_MIMETYPE
          The 'no-type' content-type.
(package private) static java.util.regex.Pattern TRUNCATION_REGEX
          Truncation regex.
 
Constructor Summary
MimetypeUtils()
           
 
Method Summary
static java.lang.String truncate(java.lang.String contentType)
          Truncate passed mimetype.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_TYPE_MIMETYPE

public static final java.lang.String NO_TYPE_MIMETYPE
The 'no-type' content-type. Defined in the ARC file spec at http://www.archive.org/web/researcher/ArcFileFormat.php.

See Also:
Constant Field Values

TRUNCATION_REGEX

static final java.util.regex.Pattern TRUNCATION_REGEX
Truncation regex.

Constructor Detail

MimetypeUtils

public MimetypeUtils()
Method Detail

truncate

public static java.lang.String truncate(java.lang.String contentType)
Truncate passed mimetype. Ensure no spaces. Strip encoding. Truncation required by ARC files.

Truncate at delimiters [;, ]. Truncate multi-part content type header at ';'. Apache httpclient collapses values of multiple instances of the header into one comma-separated value,therefore truncated at ','. Current ia_tools that work with arc files expect 5-column space-separated meta-lines, therefore truncate at ' '.

Parameters:
contentType - Raw content-type.
Returns:
Computed content-type made from passed content-type after running it through a set of rules.


Copyright © 2003-2011 Internet Archive. All Rights Reserved.