Class UserBlobPart

All Implemented Interfaces:
PropertyChangeSource, Rebindable

public class UserBlobPart extends BlobPart
A concrete BlobPart implementation for binary content provided by the user. It publishes itself to the parent message only after full initialization.
Author:
anahata
  • Constructor Details

    • UserBlobPart

      UserBlobPart(@NonNull @NonNull AbstractMessage message, @NonNull @NonNull String mimeType, @NonNull @NonNull byte[] data)
      Constructs a new UserBlobPart and adds it to the parent message.
      Parameters:
      message - The parent message.
      mimeType - The MIME type.
      data - The binary data.
    • UserBlobPart

      UserBlobPart(@NonNull @NonNull AbstractMessage message, @NonNull @NonNull String mimeType, @NonNull @NonNull byte[] data, @NonNull @NonNull Path sourcePath)
  • Method Details

    • from

      public static UserBlobPart from(@NonNull @NonNull AbstractMessage message, @NonNull @NonNull Path path) throws Exception
      A convenience factory method to create a UserBlobPart from a local file path.
      Parameters:
      message - The message this part belongs to.
      path - The path to the file.
      Returns:
      A new UserBlobPart instance.
      Throws:
      IOException - if there's an error reading the file.
      Exception - if there's an error detecting the MIME type.
    • from

      public static UserBlobPart from(@NonNull @NonNull AbstractMessage message, @NonNull @NonNull File file) throws Exception
      A convenience factory method to create a UserBlobPart from a legacy File object.
      Parameters:
      message - The message this part belongs to.
      file - The file to read.
      Returns:
      A new UserBlobPart instance.
      Throws:
      Exception - if there's an error reading the file or detecting the MIME type.