". If this flag is not provided, the dfault location is
the value of the "java.io.tmpdir" system property.
If key "-XDwritezipindexfiles" is specified, there will be new optimized index file
created for each archive, used by the compiler for compilation, at location,
specified by "cachezipindexdir" option.
If nonBatchMode option is specified (-XDnonBatchMode) the compiler will use timestamp
checking to reindex the zip files if it is needed. In batch mode the timestamps are not checked
and the compiler uses the cached indexes.
|
Method Summary |
private void |
checkIndex()
Here we need to make sure that the ZipFileIndex is valid. |
private void |
cleanupState()
|
static void |
clearCache()
|
static void |
clearCache(long timeNotUsed)
|
void |
close()
|
private void |
closeFile()
|
boolean |
contains(RelativePath path)
Tests if a specific path exists in the zip. |
protected void |
finalize()
|
private static int |
get2ByteLittleEndian(byte[] buf,
int pos)
return the two bytes buf[pos], buf[pos+1] as an unsigned integer in little
endian format. |
private static int |
get4ByteLittleEndian(byte[] buf,
int pos)
return the 4 bytes buf[i..i+3] as an integer in little endian format. |
java.util.Set<RelativePath.RelativeDirectory> |
getAllDirectories()
|
java.util.List<java.lang.String> |
getDirectories(RelativePath.RelativeDirectory path)
|
static ZipFileIndex |
getExistingZipIndex(java.io.File zipFile)
|
List<java.lang.String> |
getFiles(RelativePath.RelativeDirectory path)
Returns a javac List of filenames within an absolute path in the ZipFileIndex. |
private byte[] |
getHeader(ZipFileIndex.Entry entry)
|
private java.io.File |
getIndexFile()
|
long |
getLastModified(RelativePath.RelativeFile path)
|
private RelativePath.RelativeDirectory |
getRelativeDirectory(java.lang.String path)
|
java.io.File |
getZipFile()
|
static ZipFileIndex |
getZipFileIndex(java.io.File zipFile,
RelativePath.RelativeDirectory symbolFilePrefix,
boolean useCache,
java.lang.String cacheLocation,
boolean writeIndex)
|
static java.util.List<ZipFileIndex> |
getZipFileIndexes()
Returns a list of all ZipFileIndex entries |
static java.util.List<ZipFileIndex> |
getZipFileIndexes(boolean openedOnly)
Returns a list of all ZipFileIndex entries |
long |
getZipFileLastModified()
Returns the last modified timestamp of a zip file. |
(package private) ZipFileIndex.Entry |
getZipIndexEntry(RelativePath path)
Returns the ZipFileIndexEntry for an absolute path, if there is one. |
private int |
inflate(byte[] src,
byte[] dest)
|
boolean |
isDirectory(RelativePath path)
|
boolean |
isOpen()
|
private boolean |
isUpToDate()
|
int |
length(RelativePath.RelativeFile path)
|
private void |
openFile()
|
byte[] |
read(RelativePath.RelativeFile path)
|
int |
read(RelativePath.RelativeFile path,
byte[] buffer)
|
(package private) byte[] |
read(ZipFileIndex.Entry entry)
|
(package private) int |
read(ZipFileIndex.Entry entry,
byte[] buffer)
|
private byte[] |
readBytes(ZipFileIndex.Entry entry)
|
private int |
readBytes(ZipFileIndex.Entry entry,
byte[] buffer)
|
private boolean |
readIndex()
|
static void |
removeFromCache(java.io.File file)
|
static void |
setOpenedIndexes(java.util.List<ZipFileIndex> indexes)
Sets already opened list of ZipFileIndexes from an outside client
of the compiler. |
java.lang.String |
toString()
|
private boolean |
writeIndex()
|
boolean |
writeZipIndex()
|
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
MIN_CHAR
private static final java.lang.String MIN_CHAR
MAX_CHAR
private static final java.lang.String MAX_CHAR
NOT_MODIFIED
public static final long NOT_MODIFIED
- See Also:
- Constant Field Values
zipFileIndexCache
private static java.util.Map<java.io.File,ZipFileIndex> zipFileIndexCache
lock
private static java.util.concurrent.locks.ReentrantLock lock
NON_BATCH_MODE
private static boolean NON_BATCH_MODE
directories
private java.util.Map<RelativePath.RelativeDirectory,ZipFileIndex.DirectoryEntry> directories
allDirs
private java.util.Set<RelativePath.RelativeDirectory> allDirs
zipFile
private java.io.File zipFile
zipFileLastModified
private long zipFileLastModified
zipRandomFile
private java.io.RandomAccessFile zipRandomFile
entries
private ZipFileIndex.Entry[] entries
readFromIndex
private boolean readFromIndex
zipIndexFile
private java.io.File zipIndexFile
triedToReadIndex
private boolean triedToReadIndex
symbolFilePrefix
final RelativePath.RelativeDirectory symbolFilePrefix
symbolFilePrefixLength
private int symbolFilePrefixLength
hasPopulatedData
private boolean hasPopulatedData
lastReferenceTimeStamp
private long lastReferenceTimeStamp
usePreindexedCache
private boolean usePreindexedCache
preindexedCacheLocation
private java.lang.String preindexedCacheLocation
writeIndex
private boolean writeIndex
relativeDirectoryCache
private java.util.Map<java.lang.String,java.lang.ref.SoftReference<RelativePath.RelativeDirectory>> relativeDirectoryCache
inflater
private static java.util.zip.Inflater inflater
ZipFileIndex
private ZipFileIndex(java.io.File zipFile,
RelativePath.RelativeDirectory symbolFilePrefix,
boolean writeIndex,
boolean useCache,
java.lang.String cacheLocation)
throws java.io.IOException
- Throws:
java.io.IOException
getZipFileIndexes
public static java.util.List<ZipFileIndex> getZipFileIndexes()
- Returns a list of all ZipFileIndex entries
- Returns:
- A list of ZipFileIndex entries, or an empty list
getZipFileIndexes
public static java.util.List<ZipFileIndex> getZipFileIndexes(boolean openedOnly)
- Returns a list of all ZipFileIndex entries
- Parameters:
openedOnly - If true it returns a list of only opened ZipFileIndex entries, otherwise
all ZipFileEntry(s) are included into the list.
- Returns:
- A list of ZipFileIndex entries, or an empty list
isOpen
public boolean isOpen()
getZipFileIndex
public static ZipFileIndex getZipFileIndex(java.io.File zipFile,
RelativePath.RelativeDirectory symbolFilePrefix,
boolean useCache,
java.lang.String cacheLocation,
boolean writeIndex)
throws java.io.IOException
- Throws:
java.io.IOException
getExistingZipIndex
public static ZipFileIndex getExistingZipIndex(java.io.File zipFile)
clearCache
public static void clearCache()
clearCache
public static void clearCache(long timeNotUsed)
removeFromCache
public static void removeFromCache(java.io.File file)
setOpenedIndexes
public static void setOpenedIndexes(java.util.List<ZipFileIndex> indexes)
throws java.lang.IllegalStateException
- Sets already opened list of ZipFileIndexes from an outside client
of the compiler. This functionality should be used in a non-batch clients of the compiler.
- Throws:
java.lang.IllegalStateException
toString
public java.lang.String toString()
- Overrides:
toString in class java.lang.Object
finalize
protected void finalize()
- Overrides:
finalize in class java.lang.Object
isUpToDate
private boolean isUpToDate()
checkIndex
private void checkIndex()
throws java.io.IOException
- Here we need to make sure that the ZipFileIndex is valid. Check the timestamp of the file and
if its the same as the one at the time the index was build we don't need to reopen anything.
- Throws:
java.io.IOException
openFile
private void openFile()
throws java.io.FileNotFoundException
- Throws:
java.io.FileNotFoundException
cleanupState
private void cleanupState()
close
public void close()
closeFile
private void closeFile()
getZipIndexEntry
ZipFileIndex.Entry getZipIndexEntry(RelativePath path)
- Returns the ZipFileIndexEntry for an absolute path, if there is one.
getFiles
public List<java.lang.String> getFiles(RelativePath.RelativeDirectory path)
- Returns a javac List of filenames within an absolute path in the ZipFileIndex.
getDirectories
public java.util.List<java.lang.String> getDirectories(RelativePath.RelativeDirectory path)
getAllDirectories
public java.util.Set<RelativePath.RelativeDirectory> getAllDirectories()
contains
public boolean contains(RelativePath path)
- Tests if a specific path exists in the zip. This method will return true
for file entries and directories.
- Parameters:
path - A path within the zip.
- Returns:
- True if the path is a file or dir, false otherwise.
isDirectory
public boolean isDirectory(RelativePath path)
throws java.io.IOException
- Throws:
java.io.IOException
getLastModified
public long getLastModified(RelativePath.RelativeFile path)
throws java.io.IOException
- Throws:
java.io.IOException
length
public int length(RelativePath.RelativeFile path)
throws java.io.IOException
- Throws:
java.io.IOException
read
public byte[] read(RelativePath.RelativeFile path)
throws java.io.IOException
- Throws:
java.io.IOException
read
byte[] read(ZipFileIndex.Entry entry)
throws java.io.IOException
- Throws:
java.io.IOException
read
public int read(RelativePath.RelativeFile path,
byte[] buffer)
throws java.io.IOException
- Throws:
java.io.IOException
read
int read(ZipFileIndex.Entry entry,
byte[] buffer)
throws java.io.IOException
- Throws:
java.io.IOException
readBytes
private byte[] readBytes(ZipFileIndex.Entry entry)
throws java.io.IOException
- Throws:
java.io.IOException
readBytes
private int readBytes(ZipFileIndex.Entry entry,
byte[] buffer)
throws java.io.IOException
- Throws:
java.io.IOException
getHeader
private byte[] getHeader(ZipFileIndex.Entry entry)
throws java.io.IOException
- Throws:
java.io.IOException
inflate
private int inflate(byte[] src,
byte[] dest)
get2ByteLittleEndian
private static int get2ByteLittleEndian(byte[] buf,
int pos)
- return the two bytes buf[pos], buf[pos+1] as an unsigned integer in little
endian format.
get4ByteLittleEndian
private static int get4ByteLittleEndian(byte[] buf,
int pos)
- return the 4 bytes buf[i..i+3] as an integer in little endian format.
getZipFileLastModified
public long getZipFileLastModified()
throws java.io.IOException
- Returns the last modified timestamp of a zip file.
- Returns:
- long
- Throws:
java.io.IOException
readIndex
private boolean readIndex()
writeIndex
private boolean writeIndex()
writeZipIndex
public boolean writeZipIndex()
getIndexFile
private java.io.File getIndexFile()
getZipFile
public java.io.File getZipFile()
getRelativeDirectory
private RelativePath.RelativeDirectory getRelativeDirectory(java.lang.String path)