Interface IAS4Attachment

All Known Implementing Classes:
WSS4JAttachment

public interface IAS4Attachment
Read-only interface for an attachment.
Author:
Philip Helger
  • Method Details

    • getId

      String getId()
      Returns:
      The attachment Content ID. Must NOT contain any "cid" prefix.
    • getMimeType

      String getMimeType()
      Returns:
      The MIME type in a string representation. If the attachment was compressed and the MimeType part property was set it can be queried via getUncompressedMimeType()
      See Also:
    • getUncompressedMimeType

      @Nullable String getUncompressedMimeType()
      Returns:
      The MIME type of the uncompressed attachment. May be null. This is only set, if compression was active. Otherwise use getMimeType().
      See Also:
    • getSourceStream

      @Nonnull InputStream getSourceStream()
      Get the source stream of the attachment using the default resource helper. The streams retrieved by this method are automatically closed when the respective resource helper goes out of scope.
      Returns:
      A non-null InputStream on the source.
    • getSourceStream

      @Nonnull InputStream getSourceStream(@Nonnull AS4ResourceHelper aResourceHelper)
      Get the source stream of the attachment using the provided resource helper, to automatically close the stream at the end of the message. This can be helpful, if the source helper is already out of scope.
      Parameters:
      aResourceHelper - The resource helper to use. May not be null.
      Returns:
      A non-null InputStream on the source.
    • getInputStreamProvider

      @Nullable com.helger.commons.io.IHasInputStream getInputStreamProvider()
      This is primarily an internal method. If you use it, you need to make sure to close the streams yourself if you open them.
      Returns:
      The internal input stream provider. May be null.
    • isRepeatable

      default boolean isRepeatable()
      Returns:
      true if the input stream backing this attachment can be read multiple times, false if not.
    • getContentTransferEncoding

      @Nonnull com.helger.mail.cte.EContentTransferEncoding getContentTransferEncoding()
      Returns:
      The content transfer encoding to be used. Required for MIME multipart handling only. May not be null.
    • getCompressionMode

      @Nullable EAS4CompressionMode getCompressionMode()
      Returns:
      The compression mode to use or null if the attachment is not compressed.
    • hasCompressionMode

      default boolean hasCompressionMode()
      Returns:
      true if a compression mode is set, false if not.
    • getCharset

      @Nonnull default Charset getCharset()
      Returns:
      The defined character set, falling back to ISO-8859-1 if none is defined.
    • getCharsetOrDefault

      @Nullable Charset getCharsetOrDefault(@Nullable Charset aDefault)
      Get the specified character set or the provided default value.
      Parameters:
      aDefault - The default value to be returned, if no character set is provided. May be null.
      Returns:
      Only null if no character set is defined and the provided default value is null.
    • hasCharset

      boolean hasCharset()
      Returns:
      true if a character set is defined, false if not.
    • customPartProperties

      @Nonnull @ReturnsMutableObject com.helger.commons.collection.impl.ICommonsOrderedMap<String,String> customPartProperties()
      Returns:
      A non-null but maybe empty map of custom PartInfo/PartProperties for the UserMessage.
      Since:
      0.12.0