Class MimetypeUtils

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

public class MimetypeUtils extends Object
Class of mimetype utilities.
Author:
stack
  • Field Details

    • NO_TYPE_MIMETYPE

      public static final 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:
    • TRUNCATION_REGEX

      protected static final Pattern TRUNCATION_REGEX
      Truncation regex.
  • Constructor Details

    • MimetypeUtils

      public MimetypeUtils()
  • Method Details

    • truncate

      public static String truncate(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.