Package org.eclipse.birt.core.archive.compound

# Class ArchiveFile

java.lang.Object
org.eclipse.birt.core.archive.compound.ArchiveFile

All Implemented Interfaces:
  `IArchiveFile`

public class ArchiveFile extends Object implements IArchiveFile
change the default format to ext2.

## Field Summary

Fields
Modifier and Type
Field
Description
`protected IArchiveFile`
`af`
`protected String`
`archiveName`
the archive file name.
`static final boolean`
`enableFileCache`
`static final boolean`
`enableSystemCache`
`static final int`
`FILE_CACHE_SIZE`
`static final org.eclipse.birt.core.archive.cache.SystemCacheManager`
`systemCacheManager`
`protected String`
`systemId`
`protected static File`
`tmpFileFolder`
`protected String`
`tmpFileName`
`protected boolean`
`zipOnClose`

## Constructor Summary

Constructors
Constructor
Description
`ArchiveFile(String fileName, String mode)`
`ArchiveFile(String systemId, String fileName, String mode)`

## Method Summary

Modifier and Type
Method
Description
`void`
`close()`
close the archive.
`ArchiveEntry`
`createEntry(String name)`
`boolean`
`exists(String name)`
`void`
`flush()`
`String`
`getDependId()`
`long`
`getLength()`
`String`
`getName()`
get the archive name.
`String`
`getSystemId()`
`static long`
`getTotalUsedCache()`
`long`
`getUsedCache()`
`List<String>`
`listEntries(String namePattern)`
`Object`
`lockEntry(String name)`
`protected void`
`openArchiveForAppending()`
`protected void`
`openArchiveForReading()`
`ArchiveEntry`
`openEntry(String name)`
`void`
`refresh()`
`boolean`
`removeEntry(String name)`
`void`
`save()`
save the file.
`void`
`saveAs(String fileName)`
`void`
`setCacheSize(long cacheSize)`
`static void`
`setTempFileFolder(String folderPath)`
Sets the temporary file folder to contain temporary files.
`static void`
`setTotalCacheSize(long size)`
`void`
`unlockEntry(Object locker)`
`protected void`
`unzip(String src, String tgt)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### 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 String archiveName
the archive file name.

### systemId

protected String systemId

### zipOnClose

protected boolean zipOnClose

### tmpFileName

protected String tmpFileName

### tmpFileFolder

protected static File tmpFileFolder

### af

protected IArchiveFile af

## Constructor Details

### ArchiveFile

public ArchiveFile(String fileName, String mode) throws IOException

Throws:
  `IOException`

### ArchiveFile

public ArchiveFile(String systemId, String fileName, String mode) throws IOException

Throws:
  `IOException`

## Method Details

### openArchiveForReading

protected void openArchiveForReading() throws IOException

Throws:
  `IOException`

### openArchiveForAppending

protected void openArchiveForAppending() throws IOException

Throws:
  `IOException`

### getName

public 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 String getDependId()

Specified by:
  `getDependId` in interface `IArchiveFile`

### getSystemId

public String getSystemId()

Specified by:
  `getSystemId` in interface `IArchiveFile`

### close

public void close() throws 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:
  `IOException`

### setCacheSize

public void setCacheSize(long cacheSize)

Specified by:
  `setCacheSize` in interface `IArchiveFile`

### getUsedCache

public long getUsedCache()

Specified by:
  `getUsedCache` in interface `IArchiveFile`

### getTotalUsedCache

public static long getTotalUsedCache()

### setTotalCacheSize

public static void setTotalCacheSize(long size)

### saveAs

public void saveAs(String fileName) throws IOException

Throws:
  `IOException`

### save

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

Specified by:
  `save` in interface `IArchiveFile`
Throws:
  `IOException`

### flush

public void flush() throws IOException

Specified by:
  `flush` in interface `IArchiveFile`
Throws:
  `IOException`

### refresh

public void refresh() throws IOException

Specified by:
  `refresh` in interface `IArchiveFile`
Throws:
  `IOException`

### exists

public boolean exists(String name)

Specified by:
  `exists` in interface `IArchiveFile`

### openEntry

public ArchiveEntry openEntry(String name) throws IOException

Specified by:
  `openEntry` in interface `IArchiveFile`
Throws:
  `IOException`

### listEntries

public List<String> listEntries(String namePattern)

Specified by:
  `listEntries` in interface `IArchiveFile`

### createEntry

public ArchiveEntry createEntry(String name) throws IOException

Specified by:
  `createEntry` in interface `IArchiveFile`
Throws:
  `IOException`

### removeEntry

public boolean removeEntry(String name) throws IOException

Specified by:
  `removeEntry` in interface `IArchiveFile`
Throws:
  `IOException`

### lockEntry

public Object lockEntry(String name) throws IOException

Specified by:
  `lockEntry` in interface `IArchiveFile`
Throws:
  `IOException`

### unlockEntry

public void unlockEntry(Object locker) throws IOException

Specified by:
  `unlockEntry` in interface `IArchiveFile`
Throws:
  `IOException`

### getLength

public long getLength()

Specified by:
  `getLength` in interface `IArchiveFile`

### unzip

protected void unzip(String src, String tgt) throws IOException

Throws:
  `IOException`

### setTempFileFolder

public static void setTempFileFolder(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 in `File.createTempFile(String, String, File)`

Parameters:
  `folderPath` - folder path