public class StreamableResourceImpl extends Object implements StreamableResource
Modifier and Type | Field and Description |
---|---|
protected AssetChecksumGenerator |
assetChecksumGenerator |
protected BytestreamCache |
bytestreamCache |
protected CompressionStatus |
compression |
protected String |
description |
protected long |
lastModified |
protected ResponseCustomizer |
responseCustomizer |
Constructor and Description |
---|
StreamableResourceImpl(String description,
ContentType contentType,
CompressionStatus compression,
long lastModified,
BytestreamCache bytestreamCache,
AssetChecksumGenerator assetChecksumGenerator,
ResponseCustomizer responseCustomizer) |
Modifier and Type | Method and Description |
---|---|
StreamableResource |
addResponseCustomizer(ResponseCustomizer customizer)
Returns a new StreamableResource that includes the provided customizer.
|
String |
getChecksum()
Compute and return the checksum of the content for this asset; the checksum should be computed
based on the uncompressed content.
|
CompressionStatus |
getCompression()
Indicates if the content is compressed, or compressable.
|
ContentType |
getContentType()
Returns the resource's content type.
|
String |
getDescription()
Describes the underlying
Resource (or resources} for this streamable resource; expressly used
as part of the object's toString() . |
long |
getLastModified()
Returns the time the resource was last modified, with accuracy to one second (so as to match
the HTTP request/response date headers).
|
ResponseCustomizer |
getResponseCustomizer()
Returns the customizer, if any, for this resource.
|
int |
getSize()
The size, in bytes, of the underlying bytestream.
|
InputStream |
openStream()
Opens the content of the resource as an input stream; the caller is responsible for closing the stream
after reading it.
|
void |
streamTo(OutputStream os)
Streams the resource's content to the provided stream.
|
String |
toString() |
StreamableResource |
withContentType(ContentType newContentType)
Returns a new StreamableResource instance with the new content type.
|
protected final String description
protected final CompressionStatus compression
protected final long lastModified
protected final BytestreamCache bytestreamCache
protected final AssetChecksumGenerator assetChecksumGenerator
protected final ResponseCustomizer responseCustomizer
public StreamableResourceImpl(String description, ContentType contentType, CompressionStatus compression, long lastModified, BytestreamCache bytestreamCache, AssetChecksumGenerator assetChecksumGenerator, ResponseCustomizer responseCustomizer)
public String getDescription()
StreamableResource
Resource
(or resources} for this streamable resource; expressly used
as part of the object's toString()
.getDescription
in interface StreamableResource
public CompressionStatus getCompression()
StreamableResource
getCompression
in interface StreamableResource
public ContentType getContentType()
StreamableResource
getContentType
in interface StreamableResource
public int getSize()
StreamableResource
getSize
in interface StreamableResource
public long getLastModified()
StreamableResource
getLastModified
in interface StreamableResource
public void streamTo(OutputStream os) throws IOException
StreamableResource
streamTo
in interface StreamableResource
IOException
public InputStream openStream() throws IOException
StreamableResource
openStream
in interface StreamableResource
IOException
public String getChecksum() throws IOException
StreamableResource
getChecksum
in interface StreamableResource
IOException
AssetChecksumGenerator.generateChecksum(StreamableResource)
public StreamableResource addResponseCustomizer(ResponseCustomizer customizer)
StreamableResource
addResponseCustomizer
in interface StreamableResource
public ResponseCustomizer getResponseCustomizer()
StreamableResource
getResponseCustomizer
in interface StreamableResource
public StreamableResource withContentType(ContentType newContentType)
StreamableResource
withContentType
in interface StreamableResource
5.6.3 - Copyright © 2003-2021 The Apache Software Foundation.