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 int
the first block of allocation tableprotected org.eclipse.birt.core.archive.compound.AllocTable
allocation table of the archive fileprotected String
the archive file name.protected int
protected org.eclipse.birt.core.archive.cache.FileCacheManager
cache manager of the archive file.static final int
Size of a physical block, counted in bytes.static final int
default size of buffer pool - number of buffer blocks in buffer poolprotected String
static final long
The magic tag of the archive file: "RPTDOC"static final long
After support system id in archive file, DOCUMENT_VERSION_1 is writen into header.static final long
archive entries in the tablestatic final int
the size of a entry in the entry table, counted in bytesstatic final int
the first block of entry tableprotected org.eclipse.birt.core.archive.compound.NameTable
entry table of the archive filestatic final int
File status value: finishedprotected org.eclipse.birt.core.archive.compound.ArchiveHeader
header statusstatic final int
the block of archive headerprotected boolean
the archive file is appended.protected boolean
if the file is closed.protected boolean
the archive file is transient.protected boolean
the archive file is writable.static final int
Min size of buffer pool - number of buffer blocks in buffer poolstatic final String
the system property defines the block size, it should be times of 1024.protected RandomAccessFile
the physical file correspond to this compound file systemprotected String
protected int
the total blocks exits in this fileprotected int
the 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 TypeMethodDescriptionvoid
close()
close the archive.protected Block
createEntry
(String name) boolean
void
flush()
long
getName()
get the archive name.long
listEntries
(String namePattern) void
refresh()
boolean
removeEntry
(String name) void
save()
void
setCacheSize
(long cacheSize) set up the cache size.protected void
unloadBlock
(Block block) void
unlockEntry
(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:
setCacheSize
in interfaceIArchiveFile
- Parameters:
cacheSize
- cache size in bytes
-
getUsedCache
public long getUsedCache()- Specified by:
getUsedCache
in interfaceIArchiveFile
-
getDependId
- Specified by:
getDependId
in interfaceIArchiveFile
-
getSystemId
- Specified by:
getSystemId
in interfaceIArchiveFile
-
getName
get the archive name. the archive name is the file name used to create the archive instance.- Specified by:
getName
in 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:
close
in interfaceIArchiveFile
- Throws:
IOException
-
flush
- Specified by:
flush
in interfaceIArchiveFile
- Throws:
IOException
-
save
- Specified by:
save
in interfaceIArchiveFile
- Throws:
IOException
-
refresh
- Specified by:
refresh
in interfaceIArchiveFile
- Throws:
IOException
-
exists
- Specified by:
exists
in interfaceIArchiveFile
-
getLength
public long getLength()- Specified by:
getLength
in interfaceIArchiveFile
-
openEntry
- Specified by:
openEntry
in interfaceIArchiveFile
- Throws:
IOException
-
listEntries
- Specified by:
listEntries
in interfaceIArchiveFile
-
createEntry
- Specified by:
createEntry
in interfaceIArchiveFile
- Throws:
IOException
-
removeEntry
- Specified by:
removeEntry
in interfaceIArchiveFile
- Throws:
IOException
-
lockEntry
- Specified by:
lockEntry
in interfaceIArchiveFile
- Throws:
IOException
-
unlockEntry
- Specified by:
unlockEntry
in interfaceIArchiveFile
- Throws:
IOException
-
createBlock
- Throws:
IOException
-
unloadBlock
- Throws:
IOException
-