Class HttpRequestOptions.FileStreamField

  • Enclosing class:
    HttpRequestOptions

    public static class HttpRequestOptions.FileStreamField
    extends Object
    File field wrapper for use in form data body. It is better to use this class for file fields because it explicitly gives opportunity to set files as File or InputStream.
    • Constructor Detail

      • FileStreamField

        public FileStreamField​(InputStream stream,
                               String fileName)
        Constructs the file field wrapper from InputStream and the file name
        Parameters:
        stream - input stream with contents of the file
        fileName - file name under which the file will be sent
    • Method Detail

      • setFile

        public void setFile​(InputStream stream,
                            String fileName)
        Sets file from InputStream object
        Parameters:
        stream - input stream with contents of the file
        fileName - file name under which the file will be sent
      • getStream

        public InputStream getStream()
        Returns InputStream with contents of the file
        Returns:
        input stream
      • getFileName

        public String getFileName()
        Returns the file name under which the file will be sent in request
        Returns:
        file name