Class ArchiveFile
- java.lang.Object
-
- org.eclipse.birt.core.archive.compound.ArchiveFile
-
- All Implemented Interfaces:
IArchiveFile
public class ArchiveFile extends java.lang.Object implements IArchiveFile
change the default format to ext2.
-
-
Field Summary
Fields Modifier and Type Field Description protected IArchiveFileafprotected java.lang.StringarchiveNamethe archive file name.static booleanenableFileCachestatic booleanenableSystemCachestatic intFILE_CACHE_SIZEstatic org.eclipse.birt.core.archive.cache.SystemCacheManagersystemCacheManagerprotected java.lang.StringsystemIdprotected static java.io.FiletmpFileFolderprotected java.lang.StringtmpFileNameprotected booleanzipOnClose
-
Constructor Summary
Constructors Constructor Description ArchiveFile(java.lang.String fileName, java.lang.String mode)ArchiveFile(java.lang.String systemId, java.lang.String fileName, java.lang.String mode)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()close the archive.ArchiveEntrycreateEntry(java.lang.String name)booleanexists(java.lang.String name)voidflush()java.lang.StringgetDependId()longgetLength()java.lang.StringgetName()get the archive name.java.lang.StringgetSystemId()static longgetTotalUsedCache()longgetUsedCache()java.util.List<java.lang.String>listEntries(java.lang.String namePattern)java.lang.ObjectlockEntry(java.lang.String name)protected voidopenArchiveForAppending()protected voidopenArchiveForReading()ArchiveEntryopenEntry(java.lang.String name)voidrefresh()booleanremoveEntry(java.lang.String name)voidsave()save the file.voidsaveAs(java.lang.String fileName)voidsetCacheSize(long cacheSize)static voidsetTempFileFolder(java.lang.String folderPath)Sets the temporary file folder to contain temporary files.static voidsetTotalCacheSize(long size)voidunlockEntry(java.lang.Object locker)protected voidunzip(java.lang.String src, java.lang.String tgt)
-
-
-
Field Detail
-
enableSystemCache
public static final boolean enableSystemCache
- See Also:
- Constant Field Values
-
systemCacheManager
public static final org.eclipse.birt.core.archive.cache.SystemCacheManager systemCacheManager
-
enableFileCache
public static final boolean enableFileCache
- See Also:
- Constant Field Values
-
FILE_CACHE_SIZE
public static final int FILE_CACHE_SIZE
- See Also:
- Constant Field Values
-
archiveName
protected java.lang.String archiveName
the archive file name.
-
systemId
protected java.lang.String systemId
-
zipOnClose
protected boolean zipOnClose
-
tmpFileName
protected java.lang.String tmpFileName
-
tmpFileFolder
protected static java.io.File tmpFileFolder
-
af
protected IArchiveFile af
-
-
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:
getNamein interfaceIArchiveFile- Returns:
- archive name.
-
getDependId
public java.lang.String getDependId()
- Specified by:
getDependIdin interfaceIArchiveFile
-
getSystemId
public java.lang.String getSystemId()
- Specified by:
getSystemIdin interfaceIArchiveFile
-
close
public void close() throws java.io.IOExceptionclose 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:
java.io.IOException
-
setCacheSize
public void setCacheSize(long cacheSize)
- Specified by:
setCacheSizein interfaceIArchiveFile
-
getUsedCache
public long getUsedCache()
- Specified by:
getUsedCachein interfaceIArchiveFile
-
getTotalUsedCache
public static long getTotalUsedCache()
-
setTotalCacheSize
public static void setTotalCacheSize(long size)
-
saveAs
public void saveAs(java.lang.String fileName) throws java.io.IOException- Throws:
java.io.IOException
-
save
public void save() throws java.io.IOExceptionsave the file. If the file is transient file, after saving, it will be converts to normal file.- Specified by:
savein interfaceIArchiveFile- Throws:
java.io.IOException
-
flush
public void flush() throws java.io.IOException- Specified by:
flushin interfaceIArchiveFile- Throws:
java.io.IOException
-
refresh
public void refresh() throws java.io.IOException- Specified by:
refreshin interfaceIArchiveFile- Throws:
java.io.IOException
-
exists
public boolean exists(java.lang.String name)
- Specified by:
existsin interfaceIArchiveFile
-
openEntry
public ArchiveEntry openEntry(java.lang.String name) throws java.io.IOException
- Specified by:
openEntryin interfaceIArchiveFile- Throws:
java.io.IOException
-
listEntries
public java.util.List<java.lang.String> listEntries(java.lang.String namePattern)
- Specified by:
listEntriesin interfaceIArchiveFile
-
createEntry
public ArchiveEntry createEntry(java.lang.String name) throws java.io.IOException
- Specified by:
createEntryin interfaceIArchiveFile- Throws:
java.io.IOException
-
removeEntry
public boolean removeEntry(java.lang.String name) throws java.io.IOException- Specified by:
removeEntryin interfaceIArchiveFile- Throws:
java.io.IOException
-
lockEntry
public java.lang.Object lockEntry(java.lang.String name) throws java.io.IOException- Specified by:
lockEntryin interfaceIArchiveFile- Throws:
java.io.IOException
-
unlockEntry
public void unlockEntry(java.lang.Object locker) throws java.io.IOException- Specified by:
unlockEntryin interfaceIArchiveFile- Throws:
java.io.IOException
-
getLength
public long getLength()
- Specified by:
getLengthin interfaceIArchiveFile
-
unzip
protected void unzip(java.lang.String src, java.lang.String tgt) throws java.io.IOException- Throws:
java.io.IOException
-
setTempFileFolder
public static void setTempFileFolder(java.lang.String folderPath)
Sets the temporary file folder to contain temporary files. This folder should be maintained by caller to clean up. If not set, default temporary file folder will be used as defined by JDK. See javadoc inFile.createTempFile(String, String, File)- Parameters:
folderPath- folder path
-
-