Class MimeNormalizers


  • public final class MimeNormalizers
    extends Object
    Factory for creating various mime type normalizers.
    • Constructor Detail

      • MimeNormalizers

        public MimeNormalizers()
    • Method Detail

      • canonicalizing

        public static IMimeNormalizer canonicalizing()
        Gets a IMimeNormalizer that normalizes the string representation of a mime type to its canonical format. E.g. text/plain; charset=utf-8 becomes text/plain; charset=utf-8.
      • composing

        public static IMimeNormalizer composing​(IMimeNormalizer... normalizers)
        Creates a IMimeNormalizer that composes multiple normalizes by chaining them together. In other words, applies the first normalizer, then passed the output to the second normalizer etc.
        Parameters:
        normalizers - Normalizers to compose.
        Returns:
        A normalizer that applies each given normalizer in order.
      • composing

        public static IMimeNormalizer composing​(Iterable<? extends IMimeNormalizer> normalizers)
        Creates a IMimeNormalizer that composes multiple normalizes by chaining them together. In other words, applies the first normalizer, then passed the output to the second normalizer etc.
        Parameters:
        normalizers - Normalizers to compose.
        Returns:
        A normalizer that applies each given normalizer in order.
      • composing

        public static IMimeNormalizer composing​(Stream<? extends IMimeNormalizer> normalizers)
        Creates a IMimeNormalizer that composes multiple normalizes by chaining them together. In other words, applies the first normalizer, then passed the output to the second normalizer etc.
        Parameters:
        normalizers - Normalizers to compose.
        Returns:
        A normalizer that applies each given normalizer in order.
      • mapping

        public static de.xima.fc.common.mime.MappingMimeNormalizer.Builder mapping()
        Creates a new mapping mime type normalizer that normalizes mime types by mapping certain types to other types.
         MimeNormalizer normalizer = MimeNormalizers.mapping()
             .addMapping("application/xml", "text/plain")
             .addMapping("text/xml", "text/plain")
             .addMapping("application/xhtml+xml", "text/plain")
             .addMapping("text/plain", "text")
             .build();
         
        Returns:
        A builder for a mapping mime type normalizer.
      • noOp

        public static IMimeNormalizer noOp()
        Returns:
        A MIME normalizer that does not normalize at all.