Class StreamableResourceImpl
java.lang.Object
org.apache.tapestry5.internal.services.assets.StreamableResourceImpl
- All Implemented Interfaces:
StreamableResource
- Direct Known Subclasses:
CompressedStreamableResource
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final AssetChecksumGeneratorprotected final BytestreamCacheprotected final CompressionStatusprotected final Stringprotected final longprotected final ResponseCustomizer -
Constructor Summary
ConstructorsConstructorDescriptionStreamableResourceImpl(String description, ContentType contentType, CompressionStatus compression, long lastModified, BytestreamCache bytestreamCache, AssetChecksumGenerator assetChecksumGenerator, ResponseCustomizer responseCustomizer) -
Method Summary
Modifier and TypeMethodDescriptionaddResponseCustomizer(ResponseCustomizer customizer) Returns a new StreamableResource that includes the provided customizer.booleanCompute and return the checksum of the content for this asset; the checksum should be computed based on the uncompressed content.Indicates if the content is compressed, or compressable.Returns the resource's content type.Describes the underlyingResource(or resources} for this streamable resource; expressly used as part of the object'stoString().longReturns the time the resource was last modified, with accuracy to one second (so as to match the HTTP request/response date headers).Returns the customizer, if any, for this resource.intgetSize()The size, in bytes, of the underlying bytestream.inthashCode()Opens the content of the resource as an input stream; the caller is responsible for closing the stream after reading it.voidstreamTo(OutputStream os) Streams the resource's content to the provided stream.toString()withContentType(ContentType newContentType) Returns a new StreamableResource instance with the new content type.
-
Field Details
-
description
-
compression
-
lastModified
-
bytestreamCache
-
assetChecksumGenerator
-
responseCustomizer
-
-
Constructor Details
-
StreamableResourceImpl
public StreamableResourceImpl(String description, ContentType contentType, CompressionStatus compression, long lastModified, BytestreamCache bytestreamCache, AssetChecksumGenerator assetChecksumGenerator, ResponseCustomizer responseCustomizer)
-
-
Method Details
-
getDescription
Description copied from interface:StreamableResourceDescribes the underlyingResource(or resources} for this streamable resource; expressly used as part of the object'stoString().- Specified by:
getDescriptionin interfaceStreamableResource
-
getCompression
Description copied from interface:StreamableResourceIndicates if the content is compressed, or compressable.- Specified by:
getCompressionin interfaceStreamableResource
-
getContentType
Description copied from interface:StreamableResourceReturns the resource's content type.- Specified by:
getContentTypein interfaceStreamableResource
-
getSize
Description copied from interface:StreamableResourceThe size, in bytes, of the underlying bytestream.- Specified by:
getSizein interfaceStreamableResource
-
getLastModified
Description copied from interface:StreamableResourceReturns the time the resource was last modified, with accuracy to one second (so as to match the HTTP request/response date headers).- Specified by:
getLastModifiedin interfaceStreamableResource
-
streamTo
Description copied from interface:StreamableResourceStreams the resource's content to the provided stream. The caller is responsible for flushing or closing the output stream.- Specified by:
streamToin interfaceStreamableResource- Throws:
IOException
-
openStream
Description copied from interface:StreamableResourceOpens the content of the resource as an input stream; the caller is responsible for closing the stream after reading it.- Specified by:
openStreamin interfaceStreamableResource- Returns:
- stream of the contents of the resource
- Throws:
IOException
-
toString
-
getChecksum
Description copied from interface:StreamableResourceCompute and return the checksum of the content for this asset; the checksum should be computed based on the uncompressed content.- Specified by:
getChecksumin interfaceStreamableResource- Returns:
- checksum for uncompressed content
- Throws:
IOException- See Also:
-
addResponseCustomizer
Description copied from interface:StreamableResourceReturns a new StreamableResource that includes the provided customizer. Customizers are invoked in the order they are added.- Specified by:
addResponseCustomizerin interfaceStreamableResource
-
getResponseCustomizer
Description copied from interface:StreamableResourceReturns the customizer, if any, for this resource. This may represent an aggregate customizer.- Specified by:
getResponseCustomizerin interfaceStreamableResource
-
withContentType
Description copied from interface:StreamableResourceReturns a new StreamableResource instance with the new content type.- Specified by:
withContentTypein interfaceStreamableResource
-
hashCode
-
equals
-