Class MimeBodyPartDataSource

  • All Implemented Interfaces:

    public class MimeBodyPartDataSource
    extends Object
    implements javax.activation.DataSource
    DataSource decorator that custom-URL-encodes the name for use with a MimeBodyPart.
    • Constructor Detail

      • MimeBodyPartDataSource

        public MimeBodyPartDataSource​(javax.activation.DataSource source)
    • Method Detail

      • getName

        public String getName()
        Specified by:
        getName in interface javax.activation.DataSource
      • getInputStream

        public InputStream getInputStream()
                                   throws IOException
        Specified by:
        getInputStream in interface javax.activation.DataSource
      • getContentType

        public String getContentType()
        Specified by:
        getContentType in interface javax.activation.DataSource
      • getWrappedSource

        public javax.activation.DataSource getWrappedSource()
      • encode

        public static String encode​(String str)
        Plugin datasources often include : as a separator, e.g. These strings need escaping before they can be used in MIME part headers. 1. However, plugin keys may include other characters not permitted in URLs, so we must do a URL encode. 2. However, per a few RFCs out there, escaped URLs are not expected in Content-Disposition and Content-Type filenames and names (resp.) so we replace the encoded bits and assume that nothing will conflict.