public final class TemporaryDocumentPreviewService extends Object implements Serializable
| Modifier and Type | Method and Description |
|---|---|
static TemporaryDocumentId |
cacheDocument(byte[] document)
Caches the document represented by the given byte array.
|
static TemporaryDocumentId |
cacheDocument(org.zkoss.util.media.Media media)
Caches the document represented by the given media.
|
static void |
disable()
Disables the temporary document preview service.
|
static boolean |
enable(long maxViewSizeInBytes)
Enables the temporary document preview service.
|
static InputStream |
getDocument(TemporaryDocumentId id)
Returns a previously cached document as an
InputStream. |
static byte[] |
getDocumentAsByteArray(TemporaryDocumentId id)
Returns a previously cached document as a byte array.
|
static boolean |
isEnabled()
Indicates if this services is enabled and if temporary documents can be cached.
|
public static boolean enable(long maxViewSizeInBytes)
maxViewSizeInBytes - maximum size of viewable documentspublic static void disable()
public static boolean isEnabled()
public static TemporaryDocumentId cacheDocument(byte[] document) throws ViewSizeException, NotEnabledException, InternalCacheException
document - The document to cache.TemporaryDocumentId identifying the cached document.ViewSizeException - when the document is too large to cacheInternalCacheException - if the caching of the temporary content failedNotEnabledException - if this service is not enabled or a failure occurred.public static TemporaryDocumentId cacheDocument(org.zkoss.util.media.Media media) throws ViewSizeException, NotEnabledException, InternalCacheException, IOException
media - The document to cache.TemporaryDocumentId identifying the cached document.ViewSizeException - when the document is too large to cacheInternalCacheException - if the caching of the temporary content failedNotEnabledException - if this service is not enabled or a failure occurred.IOException - if reading from the media failedpublic static byte[] getDocumentAsByteArray(TemporaryDocumentId id) throws Exception
id - The id of a previously cached document.Exception - if this service is not enabled, the requested document is not available in cache
or a failure occurred.public static InputStream getDocument(TemporaryDocumentId id) throws NotEnabledException, com.saperion.cache.exception.ElementNotFoundException, InternalCacheException
InputStream.id - The id of a previously cached document.InputStream.NotEnabledException - if this service is not enabled,com.saperion.cache.exception.ElementNotFoundException - if the requested document is not available in cacheInternalCacheException - if an error occurred while reading from the cacheCopyright © 2016 Lexmark Enterprise Software Deutschland GmbH. All rights reserved.