Package org.bremersee.web.multipart
Class FileAwareMultipartFile
- java.lang.Object
-
- org.bremersee.web.multipart.FileAwareMultipartFile
-
- All Implemented Interfaces:
org.springframework.core.io.InputStreamSource,org.springframework.web.multipart.MultipartFile
public class FileAwareMultipartFile extends Object implements org.springframework.web.multipart.MultipartFile
The file aware multipart file.- Author:
- Christian Bremer
-
-
Constructor Summary
Constructors Constructor Description FileAwareMultipartFile(File file, String parameterName, String originalFilename, String contentType)Instantiates a new File aware multipart file.FileAwareMultipartFile(InputStream inputStream, File tmpDir, String parameterName, String originalFilename, String contentType)Instantiates a new File aware multipart file.FileAwareMultipartFile(InputStream inputStream, String parameterName, String originalFilename, String contentType)Instantiates a new File aware multipart file.FileAwareMultipartFile(InputStream inputStream, String tmpDir, String parameterName, String originalFilename, String contentType)Instantiates a new File aware multipart file.FileAwareMultipartFile(Path file, String parameterName, String originalFilename, String contentType)Instantiates a new File aware multipart file.FileAwareMultipartFile(org.springframework.web.multipart.MultipartFile multipartFile)Instantiates a new file aware multipart file.FileAwareMultipartFile(org.springframework.web.multipart.MultipartFile multipartFile, File tmpDir)Instantiates a new file aware multipart file.FileAwareMultipartFile(org.springframework.web.multipart.MultipartFile multipartFile, String tmpDir)Instantiates a new file aware multipart file.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voiddelete(org.springframework.web.multipart.MultipartFile multipartFile)Delete.static FileAwareMultipartFileempty()Empty file aware multipart file.byte[]getBytes()StringgetContentType()InputStreamgetInputStream()StringgetName()StringgetOriginalFilename()org.springframework.core.io.ResourcegetResource()longgetSize()booleanisEmpty()voidtransferTo(File dest)
-
-
-
Constructor Detail
-
FileAwareMultipartFile
public FileAwareMultipartFile(org.springframework.web.multipart.MultipartFile multipartFile) throws IOExceptionInstantiates a new file aware multipart file.- Parameters:
multipartFile- the multipart file- Throws:
IOException- the io exception
-
FileAwareMultipartFile
public FileAwareMultipartFile(org.springframework.web.multipart.MultipartFile multipartFile, String tmpDir) throws IOExceptionInstantiates a new file aware multipart file.- Parameters:
multipartFile- the multipart filetmpDir- the tmp dir- Throws:
IOException- the io exception
-
FileAwareMultipartFile
public FileAwareMultipartFile(org.springframework.web.multipart.MultipartFile multipartFile, File tmpDir) throws IOExceptionInstantiates a new file aware multipart file.- Parameters:
multipartFile- the multipart filetmpDir- the tmp dir- Throws:
IOException- the io exception
-
FileAwareMultipartFile
public FileAwareMultipartFile(InputStream inputStream, String parameterName, String originalFilename, String contentType) throws IOException
Instantiates a new File aware multipart file.- Parameters:
inputStream- the input streamparameterName- the parameter nameoriginalFilename- the original filenamecontentType- the content type- Throws:
IOException- the io exception
-
FileAwareMultipartFile
public FileAwareMultipartFile(InputStream inputStream, String tmpDir, String parameterName, String originalFilename, String contentType) throws IOException
Instantiates a new File aware multipart file.- Parameters:
inputStream- the input streamtmpDir- the tmp dirparameterName- the parameter nameoriginalFilename- the original filenamecontentType- the content type- Throws:
IOException- the io exception
-
FileAwareMultipartFile
public FileAwareMultipartFile(InputStream inputStream, File tmpDir, String parameterName, String originalFilename, String contentType) throws IOException
Instantiates a new File aware multipart file.- Parameters:
inputStream- the input streamtmpDir- the tmp dirparameterName- the parameter nameoriginalFilename- the original filenamecontentType- the content type- Throws:
IOException- the io exception
-
FileAwareMultipartFile
public FileAwareMultipartFile(Path file, String parameterName, String originalFilename, String contentType)
Instantiates a new File aware multipart file.- Parameters:
file- the fileparameterName- the parameter nameoriginalFilename- the original filenamecontentType- the content type
-
FileAwareMultipartFile
public FileAwareMultipartFile(File file, String parameterName, String originalFilename, String contentType)
Instantiates a new File aware multipart file.- Parameters:
file- the fileparameterName- the parameter nameoriginalFilename- the original filenamecontentType- the content type
-
-
Method Detail
-
empty
public static FileAwareMultipartFile empty()
Empty file aware multipart file.- Returns:
- the file aware multipart file
-
delete
public static void delete(org.springframework.web.multipart.MultipartFile multipartFile)
Delete.- Parameters:
multipartFile- the multipart file
-
getName
@NonNull public String getName()
- Specified by:
getNamein interfaceorg.springframework.web.multipart.MultipartFile
-
getOriginalFilename
public String getOriginalFilename()
- Specified by:
getOriginalFilenamein interfaceorg.springframework.web.multipart.MultipartFile
-
getContentType
public String getContentType()
- Specified by:
getContentTypein interfaceorg.springframework.web.multipart.MultipartFile
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfaceorg.springframework.web.multipart.MultipartFile
-
getSize
public long getSize()
- Specified by:
getSizein interfaceorg.springframework.web.multipart.MultipartFile
-
getBytes
@NonNull public byte[] getBytes() throws IOException- Specified by:
getBytesin interfaceorg.springframework.web.multipart.MultipartFile- Throws:
IOException
-
getInputStream
@NonNull public InputStream getInputStream() throws IOException
- Specified by:
getInputStreamin interfaceorg.springframework.core.io.InputStreamSource- Specified by:
getInputStreamin interfaceorg.springframework.web.multipart.MultipartFile- Throws:
IOException
-
getResource
@NonNull public org.springframework.core.io.Resource getResource()
- Specified by:
getResourcein interfaceorg.springframework.web.multipart.MultipartFile
-
transferTo
public void transferTo(@NonNull File dest) throws IOException, IllegalStateException- Specified by:
transferToin interfaceorg.springframework.web.multipart.MultipartFile- Throws:
IOExceptionIllegalStateException
-
-