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 IArchiveFile
af
protected java.lang.String
archiveName
the archive file name.static boolean
enableFileCache
static boolean
enableSystemCache
static int
FILE_CACHE_SIZE
static org.eclipse.birt.core.archive.cache.SystemCacheManager
systemCacheManager
protected java.lang.String
systemId
protected static java.io.File
tmpFileFolder
protected java.lang.String
tmpFileName
protected boolean
zipOnClose
-
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 void
close()
close the archive.ArchiveEntry
createEntry(java.lang.String name)
boolean
exists(java.lang.String name)
void
flush()
java.lang.String
getDependId()
long
getLength()
java.lang.String
getName()
get the archive name.java.lang.String
getSystemId()
static long
getTotalUsedCache()
long
getUsedCache()
java.util.List<java.lang.String>
listEntries(java.lang.String namePattern)
java.lang.Object
lockEntry(java.lang.String name)
protected void
openArchiveForAppending()
protected void
openArchiveForReading()
ArchiveEntry
openEntry(java.lang.String name)
void
refresh()
boolean
removeEntry(java.lang.String name)
void
save()
save the file.void
saveAs(java.lang.String fileName)
void
setCacheSize(long cacheSize)
static void
setTempFileFolder(java.lang.String folderPath)
Sets the temporary file folder to contain temporary files.static void
setTotalCacheSize(long size)
void
unlockEntry(java.lang.Object locker)
protected void
unzip(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:
getName
in interfaceIArchiveFile
- Returns:
- archive name.
-
getDependId
public java.lang.String getDependId()
- Specified by:
getDependId
in interfaceIArchiveFile
-
getSystemId
public java.lang.String getSystemId()
- Specified by:
getSystemId
in interfaceIArchiveFile
-
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 interfaceIArchiveFile
- Throws:
java.io.IOException
-
setCacheSize
public void setCacheSize(long cacheSize)
- Specified by:
setCacheSize
in interfaceIArchiveFile
-
getUsedCache
public long getUsedCache()
- Specified by:
getUsedCache
in 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.IOException
save the file. If the file is transient file, after saving, it will be converts to normal file.- Specified by:
save
in interfaceIArchiveFile
- Throws:
java.io.IOException
-
flush
public void flush() throws java.io.IOException
- Specified by:
flush
in interfaceIArchiveFile
- Throws:
java.io.IOException
-
refresh
public void refresh() throws java.io.IOException
- Specified by:
refresh
in interfaceIArchiveFile
- Throws:
java.io.IOException
-
exists
public boolean exists(java.lang.String name)
- Specified by:
exists
in interfaceIArchiveFile
-
openEntry
public ArchiveEntry openEntry(java.lang.String name) throws java.io.IOException
- Specified by:
openEntry
in interfaceIArchiveFile
- Throws:
java.io.IOException
-
listEntries
public java.util.List<java.lang.String> listEntries(java.lang.String namePattern)
- Specified by:
listEntries
in interfaceIArchiveFile
-
createEntry
public ArchiveEntry createEntry(java.lang.String name) throws java.io.IOException
- Specified by:
createEntry
in interfaceIArchiveFile
- Throws:
java.io.IOException
-
removeEntry
public boolean removeEntry(java.lang.String name) throws java.io.IOException
- Specified by:
removeEntry
in interfaceIArchiveFile
- Throws:
java.io.IOException
-
lockEntry
public java.lang.Object lockEntry(java.lang.String name) throws java.io.IOException
- Specified by:
lockEntry
in interfaceIArchiveFile
- Throws:
java.io.IOException
-
unlockEntry
public void unlockEntry(java.lang.Object locker) throws java.io.IOException
- Specified by:
unlockEntry
in interfaceIArchiveFile
- Throws:
java.io.IOException
-
getLength
public long getLength()
- Specified by:
getLength
in 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
-
-