Package jodd.http.upload.impl
Class DiskFileUpload
- java.lang.Object
-
- jodd.http.upload.FileUpload
-
- jodd.http.upload.impl.DiskFileUpload
-
public class DiskFileUpload extends FileUpload
FileUploadthat saves uploaded files directly to destination folder.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.io.FiledestFolderprotected java.io.Filefile-
Fields inherited from class jodd.http.upload.FileUpload
fileTooBig, header, input, maxFileSize, size, valid
-
-
Constructor Summary
Constructors Constructor Description DiskFileUpload(MultipartRequestInputStream input, java.io.File destinationFolder, int maxFileSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.io.FilegetDestinationFolder()Returns destination folder.java.io.FilegetFile()Returns uploaded and saved file.byte[]getFileContent()Returns files content from disk file.java.io.InputStreamgetFileInputStream()Returns new buffered file input stream.booleanisInMemory()Returnsfalseas uploaded file is stored on disk.protected voidprocessStream()Process request input stream.-
Methods inherited from class jodd.http.upload.FileUpload
getHeader, getMaxFileSize, getSize, isFileTooBig, isUploaded, isValid, toString
-
-
-
-
Constructor Detail
-
DiskFileUpload
DiskFileUpload(MultipartRequestInputStream input, java.io.File destinationFolder, int maxFileSize)
-
-
Method Detail
-
isInMemory
public boolean isInMemory()
Returnsfalseas uploaded file is stored on disk.- Specified by:
isInMemoryin classFileUpload
-
getDestinationFolder
public java.io.File getDestinationFolder()
Returns destination folder.
-
getFile
public java.io.File getFile()
Returns uploaded and saved file.
-
getFileContent
public byte[] getFileContent() throws java.io.IOExceptionReturns files content from disk file. If error occurs, it returnsnull- Specified by:
getFileContentin classFileUpload- Throws:
java.io.IOException
-
getFileInputStream
public java.io.InputStream getFileInputStream() throws java.io.IOExceptionReturns new buffered file input stream.- Specified by:
getFileInputStreamin classFileUpload- Throws:
java.io.IOException
-
processStream
protected void processStream() throws java.io.IOExceptionDescription copied from class:FileUploadProcess request input stream. Note that file size is unknown at this point. Therefore, the implementation should set thesizeattribute after successful processing. This method also must set thevalidattribute.- Specified by:
processStreamin classFileUpload- Throws:
java.io.IOException- See Also:
MultipartRequestInputStream
-
-