Interface NamedBinary

All Superinterfaces:
org.jmolecules.ddd.types.ValueObject

public interface NamedBinary extends org.jmolecules.ddd.types.ValueObject
An abstraction for files originating from different sources.
Since:
7.5
Author:
Oliver Drotbohm
See Also:
  • Method Details

    • getName

      String getName()
      The name of the file to be stored.
      Returns:
      will never be null or empty.
    • getInputStream

      InputStream getInputStream() throws IOException
      The actual file content.
      Returns:
      will never be null.
      Throws:
      IOException
    • of

      static NamedBinary of(Path path)
      Creates a new NamedBinary for the given Path.
      Parameters:
      path - must not be null.
      Returns:
      will never be null.
    • of

      static NamedBinary of(Resource resource)
      Creates a new NamedBinary for the given Resource.
      Parameters:
      resource - must not be null.
      Returns:
      will never be null.
    • of

      static NamedBinary of(MultipartFile file)
      Creates a new NamedBinary for the given MultipartFile.
      Parameters:
      file - must not be null.
      Returns:
      will never be null.
    • withName

      default NamedBinary withName(String name)
      Creates a new NamedBinary instance with the given name. The underlying binary data does not change.
      Parameters:
      name - must not be null or empty.
      Returns:
      will never be null.
      Since:
      9.0