Package net.solarnetwork.web.support
Class MultipartFileResource
java.lang.Object
org.springframework.core.io.AbstractResource
net.solarnetwork.web.support.MultipartFileResource
- All Implemented Interfaces:
net.solarnetwork.io.TransferrableResource,org.springframework.core.io.InputStreamSource,org.springframework.core.io.Resource
public class MultipartFileResource
extends org.springframework.core.io.AbstractResource
implements org.springframework.core.io.Resource, net.solarnetwork.io.TransferrableResource
Resource that delegates operations to a MultipartFile.
This class also implements TransferrableResource so classes that
receive this as a Resource can test for that API and efficiently move
the temporary multipart file to some other location.
- Since:
- 1.15
- Version:
- 1.0
- Author:
- matt
-
Constructor Summary
ConstructorsConstructorDescriptionMultipartFileResource(org.springframework.web.multipart.MultipartFile multipart) Constructor. -
Method Summary
Methods inherited from class org.springframework.core.io.AbstractResource
contentLength, createRelative, equals, exists, getFile, getFileForLastModifiedCheck, getURI, getURL, hashCode, isOpen, isReadable, lastModified, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.core.io.Resource
contentLength, createRelative, exists, getFile, getURI, getURL, isOpen, isReadable, lastModified
-
Constructor Details
-
MultipartFileResource
public MultipartFileResource(org.springframework.web.multipart.MultipartFile multipart) Constructor.- Parameters:
multipart- the multipart file to delegate to- Throws:
IllegalArgumentException- ifmultipartis null
-
-
Method Details
-
getInputStream
- Specified by:
getInputStreamin interfaceorg.springframework.core.io.InputStreamSource- Throws:
IOException
-
getDescription
- Specified by:
getDescriptionin interfaceorg.springframework.core.io.Resource
-
getFilename
- Specified by:
getFilenamein interfaceorg.springframework.core.io.Resource- Overrides:
getFilenamein classorg.springframework.core.io.AbstractResource
-
transferTo
- Specified by:
transferToin interfacenet.solarnetwork.io.TransferrableResource- Throws:
IOExceptionIllegalStateException
-