Class ContentIDUtils


  • public class ContentIDUtils
    extends Object
    Utility class to help generate, convert RFC compliant Content-ID and cid.
    Author:
    Attila Kiraly
    • Constructor Detail

      • ContentIDUtils

        public ContentIDUtils()
    • Method Detail

      • generateContentIDFromAddrSpec

        public static String generateContentIDFromAddrSpec​(String addrSpec)
        Helper method to generate a standards-compliant Content-ID header value from the supplied addrSpec. Used rfc-s: RFC2045, RFC822
        Parameters:
        addrSpec - addrSpec
        Returns:
        the generated Content-ID
      • generateRFC822AddrSpec

        public static String generateRFC822AddrSpec()
        Helper method to generate a standards-compliant, random addr-spec as described in RFC822.
        Returns:
        the generated addrSpec
      • generateCidFromAddrSpec

        public static String generateCidFromAddrSpec​(String addrSpec)
        Helper method to generate a standards-compliant cid url from the supplied addrSpec. This implementation URL encodes everything without considering if it is needed or not. Used rfc-s: RFC2392, RFC822
        Parameters:
        addrSpec - addrSpec
        Returns:
        the generated Content-ID
      • parseAddrSpecFromCid

        public static String parseAddrSpecFromCid​(String cid)
        Parameters:
        cid - the RFC2392 compliant cid
        Returns:
        the RFC822 defined addr-spec decoded from the cid
      • parseAddrSpecFromContentID

        public static String parseAddrSpecFromContentID​(String contentID)
        Parameters:
        contentID - the RFC2045 compliant Content-ID
        Returns:
        the RFC822 defined addr-spec decoded from the contentID
      • convertCidToContentID

        public static String convertCidToContentID​(String cid)
        Parameters:
        cid - the RFC2392 compliant cid
        Returns:
        the RFC2045 compliant Content-ID representing the cid
      • convertContentIDToCid

        public static String convertContentIDToCid​(String contentID)
        Parameters:
        contentID - the RFC2045 compliant Content-ID
        Returns:
        the RFC2392 compliant cid representing the contentID