class MultipartFileResource extends AbstractResource
MultipartFile
to Resource
,
exposing the content as InputStream
and also overriding
contentLength()
as well as getFilename()
.Modifier and Type | Field and Description |
---|---|
private MultipartFile |
multipartFile |
Constructor and Description |
---|
MultipartFileResource(MultipartFile multipartFile) |
Modifier and Type | Method and Description |
---|---|
long |
contentLength()
This implementation reads the entire InputStream to calculate the
content length.
|
boolean |
equals(java.lang.Object other)
This implementation compares description strings.
|
boolean |
exists()
This implementation always returns
true . |
java.lang.String |
getDescription()
This implementation returns a description that has the Multipart name.
|
java.lang.String |
getFilename()
This implementation always returns
null ,
assuming that this resource type does not have a filename. |
java.io.InputStream |
getInputStream()
This implementation throws IllegalStateException if attempting to
read the underlying stream multiple times.
|
int |
hashCode()
This implementation returns the description's hash code.
|
boolean |
isOpen()
This implementation always returns
true . |
createRelative, getFile, getFileForLastModifiedCheck, getURI, getURL, isFile, isReadable, lastModified, readableChannel, toString
private final MultipartFile multipartFile
public MultipartFileResource(MultipartFile multipartFile)
public boolean exists()
true
.exists
in interface Resource
exists
in class AbstractResource
public boolean isOpen()
true
.isOpen
in interface Resource
isOpen
in class AbstractResource
public long contentLength()
AbstractResource
contentLength
in interface Resource
contentLength
in class AbstractResource
InputStreamSource.getInputStream()
public java.lang.String getFilename()
AbstractResource
null
,
assuming that this resource type does not have a filename.getFilename
in interface Resource
getFilename
in class AbstractResource
public java.io.InputStream getInputStream() throws java.io.IOException, java.lang.IllegalStateException
null
)java.io.FileNotFoundException
- if the underlying resource doesn't existjava.io.IOException
- if the content stream could not be openedjava.lang.IllegalStateException
public java.lang.String getDescription()
Object.toString()
public boolean equals(java.lang.Object other)
AbstractResource
equals
in class AbstractResource
Resource.getDescription()
public int hashCode()
AbstractResource
hashCode
in class AbstractResource
Resource.getDescription()