|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfnug.resource.AbstractResource
fnug.resource.DefaultCompressedResource
public class DefaultCompressedResource
Special resource that only postpones compression of bytes to the call of getBytes()
. Returned by
ResourceCollection.getCompressedJs()
and ResourceCollection.getCompressedCss()
. When a resource
change, this instance is dropped instead of reused since the change may make the aggregation be comprised of other
resources.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class fnug.resource.AbstractResource |
---|
AbstractResource.Entry |
Field Summary |
---|
Fields inherited from class fnug.resource.AbstractResource |
---|
CONTENT_TYPE_TEXT_CSS, CONTENT_TYPE_TEXT_JAVASCRIPT |
Constructor Summary | |
---|---|
DefaultCompressedResource(Bundle bundle,
String basePath,
String path,
byte[] bytes,
long lastModified,
Compressor compressor)
Constructs setting all necessary fields. |
Method Summary | |
---|---|
List<String> |
findRequiresTags()
Always throws UnsupportedOperationException . |
Bundle |
getBundle()
Returns the associated bundle. |
byte[] |
getBytes()
Retrieves the bytes via the superclass AbstractResource.getBytes() (which ultimately leads to
readEntry() ). |
protected AbstractResource.Entry |
readEntry()
Returns readLastModified() and the bytes given in the constructor. |
protected long |
readLastModified()
Returns the last modified passed into constructor. |
Methods inherited from class fnug.resource.AbstractResource |
---|
checkModified, ensureReadEntry, getBasePath, getContentType, getFullPath, getLastModified, getPath, isCss, isJs, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DefaultCompressedResource(Bundle bundle, String basePath, String path, byte[] bytes, long lastModified, Compressor compressor)
bundle
- The associated bundle.basePath
- Base path of the compressed resource. This is not always the same as the associated bundle's since a
resource collection may be for another bundle.path
- Path of the compressed resource. This is set to an md5 sum of all the aggregated paths and modified
dates.bytes
- the bytes to compress.lastModified
- The last modified date of the bytes.compressor
- The compressor to use when compressing.Method Detail |
---|
public Bundle getBundle()
getBundle
in interface HasBundle
protected AbstractResource.Entry readEntry()
readLastModified()
and the bytes given in the constructor.
readEntry
in class AbstractResource
public byte[] getBytes()
AbstractResource.getBytes()
(which ultimately leads to
readEntry()
). After that the compressed bytes are reused, never recompressed since the whole instance is
dropped if any underlying resource changes.
getBytes
in interface HasLastModifiedBytes
getBytes
in interface Resource
getBytes
in class AbstractResource
protected long readLastModified()
readLastModified
in class AbstractResource
public List<String> findRequiresTags()
UnsupportedOperationException
.
findRequiresTags
in interface Resource
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |