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 void
delete(org.springframework.web.multipart.MultipartFile multipartFile)
Delete.static FileAwareMultipartFile
empty()
Empty file aware multipart file.byte[]
getBytes()
String
getContentType()
InputStream
getInputStream()
String
getName()
String
getOriginalFilename()
org.springframework.core.io.Resource
getResource()
long
getSize()
boolean
isEmpty()
void
transferTo(File dest)
-
-
-
Constructor Detail
-
FileAwareMultipartFile
public FileAwareMultipartFile(org.springframework.web.multipart.MultipartFile multipartFile) throws IOException
Instantiates 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 IOException
Instantiates 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 IOException
Instantiates 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:
getName
in interfaceorg.springframework.web.multipart.MultipartFile
-
getOriginalFilename
public String getOriginalFilename()
- Specified by:
getOriginalFilename
in interfaceorg.springframework.web.multipart.MultipartFile
-
getContentType
public String getContentType()
- Specified by:
getContentType
in interfaceorg.springframework.web.multipart.MultipartFile
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfaceorg.springframework.web.multipart.MultipartFile
-
getSize
public long getSize()
- Specified by:
getSize
in interfaceorg.springframework.web.multipart.MultipartFile
-
getBytes
@NonNull public byte[] getBytes() throws IOException
- Specified by:
getBytes
in interfaceorg.springframework.web.multipart.MultipartFile
- Throws:
IOException
-
getInputStream
@NonNull public InputStream getInputStream() throws IOException
- Specified by:
getInputStream
in interfaceorg.springframework.core.io.InputStreamSource
- Specified by:
getInputStream
in interfaceorg.springframework.web.multipart.MultipartFile
- Throws:
IOException
-
getResource
@NonNull public org.springframework.core.io.Resource getResource()
- Specified by:
getResource
in interfaceorg.springframework.web.multipart.MultipartFile
-
transferTo
public void transferTo(@NonNull File dest) throws IOException, IllegalStateException
- Specified by:
transferTo
in interfaceorg.springframework.web.multipart.MultipartFile
- Throws:
IOException
IllegalStateException
-
-