Interface File


public interface File
A file data. Depending on how the request was constructed can contain the path to a file, or the bytes representing a file. Contains the path when the value is taken from an <input type="file"> element of the submitted form. May contain bytes in case the request in the multipart/form-data format was constructed manually in a JavaScript code.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static final class 
    A builder of File.
  • Method Summary

    Modifier and Type
    Method
    Description
    default Optional<byte[]>
    Returns the file value as an array of bytes.
    default String
    Returns a string that represents the content type determined by the file extension.
    default String
    Returns a string that represents the file name.
    Creates a new File builder.
    default Optional<String>
    Returns the file value as a file path.
  • Method Details

    • newBuilder

      static File.Builder newBuilder()
      Creates a new File builder.
      Returns:
      a new File.Builder instance
    • name

      default String name()
      Returns a string that represents the file name.
    • contentType

      default String contentType()
      Returns a string that represents the content type determined by the file extension. Equals application/octet-stream when there is no MIME type associated with the file extension.
    • pathValue

      default Optional<String> pathValue()
      Returns the file value as a file path.
    • bytesValue

      default Optional<byte[]> bytesValue()
      Returns the file value as an array of bytes.