org.eclipse.birt.core.archive.compound
Class ArchiveFile

java.lang.Object
  extended by org.eclipse.birt.core.archive.compound.ArchiveFile
All Implemented Interfaces:
IArchiveFile

public class ArchiveFile
extends java.lang.Object
implements IArchiveFile


Field Summary
protected  IArchiveFile af
           
static int ALLOC_TABLE_BLOCK
          the first block of allocation table
protected  java.lang.String archiveName
          the archive file name.
static int DEFAULT_BLOCK_SIZE
          Size of a physical block, counted in bytes.
static int DEFAULT_BUFFER_POOL_SIZE
          default size of buffer pool - number of buffer blocks in buffer pool
static long DOCUMENT_TAG
          The magic tag of the archive file: "RPTDOC"
static long DOCUMENT_VERSION_0
          After support system id in archive file, DOCUMENT_VERSION_1 is writen into header.
static long DOCUMENT_VERSION_1
           
static int ENTRY_ITEM_SIZE
          the size of a entry in the entry table, counted in bytes
static int ENTRY_TABLE_BLOCK
          the first block of entry table
static int FILE_STATUS_FINISHED
          File status value: finished
static int HEADER_BLOCK
          the block of archive header
static int MIN_BUFFER_POOL_SIZE
          Min size of buffer pool - number of buffer blocks in buffer pool
static java.lang.String PROPERTY_DEFAULT_BLOCK_SIZE
          the system property defines the block size, it should be times of 1024.
protected  java.lang.String systemId
           
 
Constructor Summary
ArchiveFile(java.lang.String fileName, java.lang.String mode)
           
ArchiveFile(java.lang.String systemId, java.lang.String fileName, java.lang.String mode)
           
 
Method Summary
 void close()
          close the archive.
 ArchiveEntry createEntry(java.lang.String name)
           
 boolean exists(java.lang.String name)
           
 void flush()
           
 java.lang.String getDependId()
           
 ArchiveEntry getEntry(java.lang.String name)
           
 java.lang.String getName()
          get the archive name.
 java.lang.String getSystemId()
           
static int getTotalUsedCache()
           
 int getUsedCache()
           
 java.util.List listEntries(java.lang.String namePattern)
           
 java.lang.Object lockEntry(ArchiveEntry entry)
           
protected  void openArchiveForAppending()
           
protected  void openArchiveForReading()
           
 void refresh()
           
 boolean removeEntry(java.lang.String name)
           
 void save()
          save the file.
 void saveAs(java.lang.String fileName)
          save the
 void setCacheSize(int cacheSize)
           
 void unlockEntry(java.lang.Object locker)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

archiveName

protected java.lang.String archiveName
the archive file name.


systemId

protected java.lang.String systemId

af

protected IArchiveFile af

DOCUMENT_TAG

public static final long DOCUMENT_TAG
The magic tag of the archive file: "RPTDOC"

See Also:
Constant Field Values

DOCUMENT_VERSION_0

public static final long DOCUMENT_VERSION_0
After support system id in archive file, DOCUMENT_VERSION_1 is writen into header.

See Also:
Constant Field Values

DOCUMENT_VERSION_1

public static final long DOCUMENT_VERSION_1
See Also:
Constant Field Values

PROPERTY_DEFAULT_BLOCK_SIZE

public static final java.lang.String PROPERTY_DEFAULT_BLOCK_SIZE
the system property defines the block size, it should be times of 1024.

See Also:
Constant Field Values

DEFAULT_BLOCK_SIZE

public static final int DEFAULT_BLOCK_SIZE
Size of a physical block, counted in bytes.

See Also:
Constant Field Values

HEADER_BLOCK

public static final int HEADER_BLOCK
the block of archive header

See Also:
Constant Field Values

ALLOC_TABLE_BLOCK

public static final int ALLOC_TABLE_BLOCK
the first block of allocation table

See Also:
Constant Field Values

ENTRY_TABLE_BLOCK

public static final int ENTRY_TABLE_BLOCK
the first block of entry table

See Also:
Constant Field Values

ENTRY_ITEM_SIZE

public static final int ENTRY_ITEM_SIZE
the size of a entry in the entry table, counted in bytes

See Also:
Constant Field Values

FILE_STATUS_FINISHED

public static final int FILE_STATUS_FINISHED
File status value: finished

See Also:
Constant Field Values

DEFAULT_BUFFER_POOL_SIZE

public static final int DEFAULT_BUFFER_POOL_SIZE
default size of buffer pool - number of buffer blocks in buffer pool

See Also:
Constant Field Values

MIN_BUFFER_POOL_SIZE

public static final int MIN_BUFFER_POOL_SIZE
Min size of buffer pool - number of buffer blocks in buffer pool

See Also:
Constant Field Values
Constructor Detail

ArchiveFile

public ArchiveFile(java.lang.String fileName,
                   java.lang.String mode)
            throws java.io.IOException
Throws:
java.io.IOException

ArchiveFile

public ArchiveFile(java.lang.String systemId,
                   java.lang.String fileName,
                   java.lang.String mode)
            throws java.io.IOException
Throws:
java.io.IOException
Method Detail

openArchiveForReading

protected void openArchiveForReading()
                              throws java.io.IOException
Throws:
java.io.IOException

openArchiveForAppending

protected void openArchiveForAppending()
                                throws java.io.IOException
Throws:
java.io.IOException

getName

public java.lang.String getName()
get the archive name. the archive name is the file name used to create the archive instance.

Specified by:
getName in interface IArchiveFile
Returns:
archive name.

getDependId

public java.lang.String getDependId()
Specified by:
getDependId in interface IArchiveFile

getSystemId

public java.lang.String getSystemId()
Specified by:
getSystemId in interface IArchiveFile

close

public void close()
           throws java.io.IOException
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 interface IArchiveFile
Throws:
java.io.IOException

setCacheSize

public void setCacheSize(int cacheSize)
Specified by:
setCacheSize in interface IArchiveFile

getUsedCache

public int getUsedCache()
Specified by:
getUsedCache in interface IArchiveFile

getTotalUsedCache

public static int getTotalUsedCache()

saveAs

public void saveAs(java.lang.String fileName)
            throws java.io.IOException
save the

Parameters:
fileName -
Throws:
java.io.IOException

save

public void save()
          throws java.io.IOException
save the file. If the file is transient file, after saving, it will be converts to normal file.

Throws:
java.io.IOException

flush

public void flush()
           throws java.io.IOException
Specified by:
flush in interface IArchiveFile
Throws:
java.io.IOException

refresh

public void refresh()
             throws java.io.IOException
Specified by:
refresh in interface IArchiveFile
Throws:
java.io.IOException

exists

public boolean exists(java.lang.String name)
Specified by:
exists in interface IArchiveFile

getEntry

public ArchiveEntry getEntry(java.lang.String name)
                      throws java.io.IOException
Specified by:
getEntry in interface IArchiveFile
Throws:
java.io.IOException

listEntries

public java.util.List listEntries(java.lang.String namePattern)
Specified by:
listEntries in interface IArchiveFile

createEntry

public ArchiveEntry createEntry(java.lang.String name)
                         throws java.io.IOException
Specified by:
createEntry in interface IArchiveFile
Throws:
java.io.IOException

removeEntry

public boolean removeEntry(java.lang.String name)
                    throws java.io.IOException
Specified by:
removeEntry in interface IArchiveFile
Throws:
java.io.IOException

lockEntry

public java.lang.Object lockEntry(ArchiveEntry entry)
                           throws java.io.IOException
Specified by:
lockEntry in interface IArchiveFile
Throws:
java.io.IOException

unlockEntry

public void unlockEntry(java.lang.Object locker)
                 throws java.io.IOException
Specified by:
unlockEntry in interface IArchiveFile
Throws:
java.io.IOException


Copyright © 2008 Actuate Corp. All rights reserved.