Class ArchiveFileV2
java.lang.Object
org.eclipse.birt.core.archive.compound.ArchiveFileV2
- All Implemented Interfaces:
IArchiveFile
the archive file contains following mode:
"r" open the file for read only.
"rw" create the file for read/write
"rw+" open file is open for read/write
"rwt" create the transient file, it will be removed after closing.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intthe first block of allocation tableprotected org.eclipse.birt.core.archive.compound.AllocTableallocation table of the archive fileprotected Stringthe archive file name.protected intprotected org.eclipse.birt.core.archive.cache.FileCacheManagercache manager of the archive file.static final intSize of a physical block, counted in bytes.static final intdefault size of buffer pool - number of buffer blocks in buffer poolprotected Stringstatic final longThe magic tag of the archive file: "RPTDOC"static final longAfter support system id in archive file, DOCUMENT_VERSION_1 is writen into header.static final longarchive entries in the tablestatic final intthe size of a entry in the entry table, counted in bytesstatic final intthe first block of entry tableprotected org.eclipse.birt.core.archive.compound.NameTableentry table of the archive filestatic final intFile status value: finishedprotected org.eclipse.birt.core.archive.compound.ArchiveHeaderheader statusstatic final intthe block of archive headerprotected booleanthe archive file is appended.protected booleanif the file is closed.protected booleanthe archive file is transient.protected booleanthe archive file is writable.static final intMin size of buffer pool - number of buffer blocks in buffer poolstatic final Stringthe system property defines the block size, it should be times of 1024.protected RandomAccessFilethe physical file correspond to this compound file systemprotected Stringprotected intthe total blocks exits in this fileprotected intthe total blocks exits in the disk -
Constructor Summary
ConstructorsConstructorDescriptionArchiveFileV2(String fileName, RandomAccessFile rf, String mode) create the archive file.ArchiveFileV2(String fileName, String mode) ArchiveFileV2(String systemId, String fileName, String mode) ArchiveFileV2(String systemId, String dependId, String fileName, RandomAccessFile rf, String mode) create the archive file.ArchiveFileV2(String systemId, String dependId, String fileName, String mode) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()close the archive.protected BlockcreateEntry(String name) booleanvoidflush()longgetName()get the archive name.longlistEntries(String namePattern) voidrefresh()booleanremoveEntry(String name) voidsave()voidsetCacheSize(long cacheSize) set up the cache size.protected voidunloadBlock(Block block) voidunlockEntry(Object locker)
-
Field Details
-
rf
the physical file correspond to this compound file system -
isClosed
protected boolean isClosedif the file is closed. -
isWritable
protected boolean isWritablethe archive file is writable. -
isTransient
protected boolean isTransientthe archive file is transient. -
isAppend
protected boolean isAppendthe archive file is appended. -
archiveName
the archive file name. -
systemId
-
dependId
-
BLOCK_SIZE
protected int BLOCK_SIZE -
head
protected org.eclipse.birt.core.archive.compound.ArchiveHeader headheader status -
allocTbl
protected org.eclipse.birt.core.archive.compound.AllocTable allocTblallocation table of the archive file -
entryTbl
protected org.eclipse.birt.core.archive.compound.NameTable entryTblentry table of the archive file -
entries
archive entries in the table -
caches
protected org.eclipse.birt.core.archive.cache.FileCacheManager cachescache manager of the archive file. -
totalBlocks
protected int totalBlocksthe total blocks exits in this file -
totalDiskBlocks
protected int totalDiskBlocksthe total blocks exits in the disk -
DOCUMENT_TAG
static final long DOCUMENT_TAGThe magic tag of the archive file: "RPTDOC"- See Also:
-
DOCUMENT_VERSION_0
static final long DOCUMENT_VERSION_0After support system id in archive file, DOCUMENT_VERSION_1 is writen into header.- See Also:
-
DOCUMENT_VERSION_1
static final long DOCUMENT_VERSION_1- See Also:
-
PROPERTY_DEFAULT_BLOCK_SIZE
the system property defines the block size, it should be times of 1024.- See Also:
-
DEFAULT_BLOCK_SIZE
static final int DEFAULT_BLOCK_SIZESize of a physical block, counted in bytes.- See Also:
-
HEADER_BLOCK
static final int HEADER_BLOCKthe block of archive header- See Also:
-
ALLOC_TABLE_BLOCK
static final int ALLOC_TABLE_BLOCKthe first block of allocation table- See Also:
-
ENTRY_TABLE_BLOCK
static final int ENTRY_TABLE_BLOCKthe first block of entry table- See Also:
-
ENTRY_ITEM_SIZE
static final int ENTRY_ITEM_SIZEthe size of a entry in the entry table, counted in bytes- See Also:
-
FILE_STATUS_FINISHED
static final int FILE_STATUS_FINISHEDFile status value: finished- See Also:
-
DEFAULT_BUFFER_POOL_SIZE
static final int DEFAULT_BUFFER_POOL_SIZEdefault size of buffer pool - number of buffer blocks in buffer pool- See Also:
-
MIN_BUFFER_POOL_SIZE
static final int MIN_BUFFER_POOL_SIZEMin size of buffer pool - number of buffer blocks in buffer pool- See Also:
-
-
Constructor Details
-
ArchiveFileV2
create the archive file.- Parameters:
fileName- file name.rf- the random access filemode- open mode.- Throws:
IOException
-
ArchiveFileV2
- Throws:
IOException
-
ArchiveFileV2
- Throws:
IOException
-
ArchiveFileV2
public ArchiveFileV2(String systemId, String dependId, String fileName, String mode) throws IOException - Throws:
IOException
-
ArchiveFileV2
public ArchiveFileV2(String systemId, String dependId, String fileName, RandomAccessFile rf, String mode) throws IOException create the archive file.- Parameters:
fileName- file name.mode- open mode.- Throws:
IOException
-
-
Method Details
-
setCacheSize
public void setCacheSize(long cacheSize) set up the cache size. the actually cache size is round to block size.- Specified by:
setCacheSizein interfaceIArchiveFile- Parameters:
cacheSize- cache size in bytes
-
getUsedCache
public long getUsedCache()- Specified by:
getUsedCachein interfaceIArchiveFile
-
getDependId
- Specified by:
getDependIdin interfaceIArchiveFile
-
getSystemId
- Specified by:
getSystemIdin interfaceIArchiveFile
-
getName
get the archive name. the archive name is the file name used to create the archive instance.- Specified by:
getNamein interfaceIArchiveFile- Returns:
- archive name.
-
close
close the archive. all changed data will be flushed into disk if the file is opened for write. the file will be removed if it is opend as transient. after close, the instance can't be used any more.- Specified by:
closein interfaceIArchiveFile- Throws:
IOException
-
flush
- Specified by:
flushin interfaceIArchiveFile- Throws:
IOException
-
save
- Specified by:
savein interfaceIArchiveFile- Throws:
IOException
-
refresh
- Specified by:
refreshin interfaceIArchiveFile- Throws:
IOException
-
exists
- Specified by:
existsin interfaceIArchiveFile
-
getLength
public long getLength()- Specified by:
getLengthin interfaceIArchiveFile
-
openEntry
- Specified by:
openEntryin interfaceIArchiveFile- Throws:
IOException
-
listEntries
- Specified by:
listEntriesin interfaceIArchiveFile
-
createEntry
- Specified by:
createEntryin interfaceIArchiveFile- Throws:
IOException
-
removeEntry
- Specified by:
removeEntryin interfaceIArchiveFile- Throws:
IOException
-
lockEntry
- Specified by:
lockEntryin interfaceIArchiveFile- Throws:
IOException
-
unlockEntry
- Specified by:
unlockEntryin interfaceIArchiveFile- Throws:
IOException
-
createBlock
- Throws:
IOException
-
unloadBlock
- Throws:
IOException
-