public class CacheManagement extends DataBinsCacheManagement
Modifier and Type | Field and Description |
---|---|
protected long |
cacheSize
This attributes is used to save the size of the cached data.
|
protected java.util.ArrayList<java.lang.Long> |
dataBinsList
Is a list used to save the data-bins identifiers.
|
static int |
FIFO |
static int |
LRU |
protected int |
managementPolicy
Indicates which is the cache management policy.
|
protected long |
maxCacheSize
Indicates which is the maximum size (in bytes) which is allowed for the
cached data.
|
static int |
NONE |
protected java.util.ArrayList<java.lang.Long> |
removedDataBins
Contains the data-bins which has been removed from the cache.
|
codestream, EXPLICIT_FORM, IMPLICIT_FORM, INDEX_RANGE, mainHeaderDataBin, metaDataBins, NO_CACHE, NUMBER_OF_BYTES, NUMBER_OF_LAYERS, precinctsDataBins, tileHeaderDataBins, WILDCARD
Constructor and Description |
---|
CacheManagement()
Constructor.
|
CacheManagement(java.lang.String fileName)
This constructor must be used if the client cache is mapped to a file.
|
Modifier and Type | Method and Description |
---|---|
void |
addJPIPMessage(JPIPMessage jpipMessage)
Adds a segment of a data-bin given as a JPIP message.
|
private byte[] |
ArrayListToArray(java.util.ArrayList<byte[]> src) |
void |
clear()
Clears the client cache but not remove the image parameters
(the
#jpcParameters attribute). |
int |
getLastLayerOfPrecinctDataBin(long inClassIdentifier)
Returns the number of layers (or number of completed packets) for the
given precinct data-bin that are stored in the cache.
|
byte[] |
getMainHeader()
Returns the image main header if it is available, otherwise returns null.
|
int |
getManagementPolicy()
Returns the
managementPolicy attribute. |
long |
getMaxCacheSize()
Returns the
maxCacheSize attribute. |
long |
getPrecinctDataBinLength(long inClassIdentifier) |
boolean |
isReady()
Check if the cache parameters has been initialized.
|
void |
list(java.io.PrintStream out)
Prints this cache out to the specified output stream.
|
void |
manage() |
private static void |
printByteStream(byte[] buffer)
Useful method for printing out a ByteStream.
|
void |
reset()
Sets the attributes to its initial values.
|
void |
setManagementPolicy(int managementPolicy)
Sets the
managementPolicy attribute. |
void |
setMaxCacheSize(long maxCacheSize)
Sets the
maxCacheSize attribute. |
java.lang.String |
toString() |
private void |
updateLists(int classIdentifier,
long inClassIdentifier) |
explicitForm, explicitForm, getCacheDescriptor, getDataBin, getDatabinLength, implicitForm, isComplete, isHeldByCurrentThread, isInCache, isLocked, keySet, lock, setJPEG2KCodestream, unlock
protected long maxCacheSize
protected int managementPolicy
public static final int NONE
public static final int LRU
public static final int FIFO
protected java.util.ArrayList<java.lang.Long> dataBinsList
protected java.util.ArrayList<java.lang.Long> removedDataBins
protected long cacheSize
maxCacheSize
.public CacheManagement()
public CacheManagement(java.lang.String fileName)
OBS:It is not being used yet.
fileName
- public final void setManagementPolicy(int managementPolicy)
managementPolicy
attribute.managementPolicy
- definition in managementPolicy
.public final int getManagementPolicy()
managementPolicy
attribute.managementPolicy
attribute.public final void setMaxCacheSize(long maxCacheSize)
maxCacheSize
attribute.maxCacheSize
- is the maximum size (in bytes) allowed for the
cached data. Only positive values are allowed, a value of 0
means unlimited.public final long getMaxCacheSize()
maxCacheSize
attribute.maxCacheSize
attribute.public void addJPIPMessage(JPIPMessage jpipMessage)
DataBinsCacheManagement
addJPIPMessage
in class DataBinsCacheManagement
jpipMessage
- definition in JPIPMessage
.public final int getLastLayerOfPrecinctDataBin(long inClassIdentifier)
inClassIdentifier
- definition in JPIPMessageHeader.inClassIdentifier.public final long getPrecinctDataBinLength(long inClassIdentifier)
inClassIdentifier
- public final byte[] getMainHeader()
public void reset()
reset
in class DataBinsCacheManagement
public void clear()
#jpcParameters
attribute).public final boolean isReady()
true
if the cache is ready. Otherwise, return
false
.public void manage()
public java.lang.String toString()
toString
in class DataBinsCacheManagement
public void list(java.io.PrintStream out)
list
in class DataBinsCacheManagement
out
- an output stream.private void updateLists(int classIdentifier, long inClassIdentifier)
classIdentifier
- inClassIdentifier
- private byte[] ArrayListToArray(java.util.ArrayList<byte[]> src)
private static void printByteStream(byte[] buffer)
buffer
- the byte array to be printed.
CADI - Copyright (C) 2007
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
Group on Interactive Coding of Images (GICI) (contact)