Interface IFileDownload


public interface IFileDownload
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    charset(Charset charset)
    Character encoding of the file content e.g.
    void
    name(String nameWithExtension)
    File name
    void
    size(long size)
    Size of the file in bytes
    void
    type(String type)
    File type as seen in official media types.
    void
    write(byte[] content)
    Write the string as the content, this will set the type to "application/octet-stream", and the size to the length of the byte array
    void
    write(io.ran.ThrowingConsumer<OutputStream,IOException> outputConsumer)
    Writes the binary contents of the file to an output stream
    void
    write(String content)
    Write the string as the content, this will set the type to "text/plain", and the size to the length of the string
  • Method Details

    • name

      void name(String nameWithExtension)
      File name
      Parameters:
      nameWithExtension - - name of the file, extension included
    • type

      void type(String type)
      File type as seen in official media types.
      Parameters:
      type - - media type of the file e.g. "application/pdf"
    • size

      void size(long size)
      Size of the file in bytes
      Parameters:
      size - - amount of bytes
    • charset

      void charset(Charset charset)
      Character encoding of the file content e.g. StandardCharsets.UTF-8
      Parameters:
      charset - - encoding
    • write

      void write(io.ran.ThrowingConsumer<OutputStream,IOException> outputConsumer)
      Writes the binary contents of the file to an output stream
      Parameters:
      outputConsumer - - consumer to write the binary content into an output stream.
    • write

      void write(String content)
      Write the string as the content, this will set the type to "text/plain", and the size to the length of the string
      Parameters:
      content - - the string content
    • write

      void write(byte[] content)
      Write the string as the content, this will set the type to "application/octet-stream", and the size to the length of the byte array
      Parameters:
      content - - the binary content