Class FileUpload

java.lang.Object
org.deltava.beans.FileUpload

public class FileUpload extends Object
A bean to store File Upload data in an HTTP servlet request. This bean can automatically detect compressed (GZIP/BZIP2) content and creates the appropriate decompresser output stream. This allows reduced memory usage when uploading large files.
Since:
1.0
Version:
10.5
Author:
Luke
  • Constructor Details

    • FileUpload

      public FileUpload(String name)
      Creates a new bean with a given name.
      Parameters:
      name - the name of the file
      Throws:
      NullPointerException - if name is null
  • Method Details

    • getName

      public String getName()
      Returns the name of the file.
      Returns:
      the file name
    • getCompression

      public Compression getCompression()
      Returns the compression type.
      Returns:
      the Compression
    • getSize

      public int getSize()
      Returns the size of the buffer.
      Returns:
      the buffer size, or zero if not loaded
    • getBuffer

      public byte[] getBuffer()
      Returns the buffer.
      Returns:
      the buffer
      See Also:
    • getInputStream

      public InputStream getInputStream()
      Returns an input stream backed by the buffer. This will automatically generate an appropriate compression inputstream if the data is in a compressed format.
      Returns:
      an input stream
      See Also:
    • load

      public void load(InputStream is) throws IOException
      Loads the buffer from an input stream.
      Parameters:
      is - the stream containing the data
      Throws:
      IOException - if an I/O error occurs