Class TransformedResource
- java.lang.Object
- org.springframework.core.io.AbstractResource
- org.springframework.core.io.ByteArrayResource
- org.springframework.web.servlet.resource.TransformedResource
- All Implemented Interfaces:
InputStreamSource
,Resource
public class TransformedResource extends ByteArrayResource
An extension ofByteArrayResource
that aResourceTransformer
can use to represent an original resource preserving all other information except the content.- Since:
- 4.1
- Author:
- Jeremy Grelle, Rossen Stoyanchev
Constructor Summary
Constructors Constructor Description TransformedResource(Resource original, byte[] transformedContent)
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getFilename()
This implementation always returnsnull
, assuming that this resource type does not have a filename.long
lastModified()
This implementation checks the timestamp of the underlying File, if available.Methods inherited from class org.springframework.core.io.ByteArrayResource
contentLength, equals, exists, getByteArray, getDescription, getInputStream, hashCode
Methods inherited from class org.springframework.core.io.AbstractResource
createRelative, getFile, getFileForLastModifiedCheck, getURI, getURL, isFile, isOpen, isReadable, readableChannel, toString
Constructor Detail
TransformedResource
public TransformedResource(Resource original, byte[] transformedContent)
Method Detail
getFilename
@Nullable public String getFilename()
Description copied from class:AbstractResource
This implementation always returnsnull
, assuming that this resource type does not have a filename.- Specified by:
getFilename
in interfaceResource
- Overrides:
getFilename
in classAbstractResource
lastModified
public long lastModified() throws IOException
Description copied from class:AbstractResource
This implementation checks the timestamp of the underlying File, if available.- Specified by:
lastModified
in interfaceResource
- Overrides:
lastModified
in classAbstractResource
- Throws:
IOException
- if the resource cannot be resolved (in the file system or as some other known physical resource type)- See Also:
AbstractResource.getFileForLastModifiedCheck()