Class FileUpload
java.lang.Object
org.deltava.beans.FileUpload
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
Returns the buffer.Returns the compression type.Returns an input stream backed by the buffer.getName()
Returns the name of the file.int
getSize()
Returns the size of the buffer.void
load
(InputStream is) Loads the buffer from an input stream.
-
Constructor Details
-
FileUpload
Creates a new bean with a given name.- Parameters:
name
- the name of the file- Throws:
NullPointerException
- if name is null
-
-
Method Details
-
getName
-
getCompression
-
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
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
Loads the buffer from an input stream.- Parameters:
is
- the stream containing the data- Throws:
IOException
- if an I/O error occurs
-