1231N/A * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. 35N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 35N/A * This code is free software; you can redistribute it and/or modify it 35N/A * under the terms of the GNU General Public License version 2 only, as 553N/A * published by the Free Software Foundation. Oracle designates this 35N/A * particular file as subject to the "Classpath" exception as provided 553N/A * by Oracle in the LICENSE file that accompanied this code. 35N/A * This code is distributed in the hope that it will be useful, but WITHOUT 35N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 35N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 35N/A * version 2 for more details (a copy is included in the LICENSE file that 35N/A * accompanied this code). 35N/A * You should have received a copy of the GNU General Public License version 35N/A * 2 along with this work; if not, write to the Free Software Foundation, 35N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 553N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 553N/A * or visit www.oracle.com if you need additional information or have any 838N/A * This class implements the building of index of a zip archive and access to 838N/A * its context. It also uses a prebuilt index if available. 838N/A * It supports invocations where it will serialize an optimized zip index file 838N/A * In order to use a secondary index file, set "usezipindex" in the Options 838N/A * object when JavacFileManager is invoked. (You can pass "-XDusezipindex" on 838N/A * provided using "-XDcachezipindexdir=<directory>". If this flag is not 838N/A * provided, the default location is the value of the "java.io.tmpdir" system 838N/A * If "-XDwritezipindexfiles" is specified, there will be new optimized index 838N/A * file created for each archive, used by the compiler for compilation, at the 838N/A * location specified by the "cachezipindexdir" option. 838N/A * If system property nonBatchMode option is specified the compiler will use 838N/A * timestamp checking to reindex the zip files if it is needed. In batch mode 838N/A * the timestamps are not checked and the compiler uses the cached indexes. 580N/A * <p><b>This is NOT part of any supported API. 332N/A * If you write code that depends on this, you do so at your own risk. 332N/A * This code and its internal interfaces are subject to change or 332N/A * deletion without notice.</b> 0N/A // ZipFileIndex data entries 0N/A // Validate integrity of the zip file 0N/A * Here we need to make sure that the ZipFileIndex is valid. Check the timestamp of the file and 0N/A * if its the same as the one at the time the index was build we don't need to reopen anything. 0N/A // Make sure there is a valid but empty index if the file doesn't exist 838N/A * Returns the ZipFileIndexEntry for a path, if there is one. 838N/A * Returns a javac List of filenames within a directory in the ZipFileIndex. 0N/A * Tests if a specific path exists in the zip. This method will return true 0N/A * for file entries and directories. 0N/A * @param path A path within the zip. 0N/A * @return True if the path is a file or dir, false otherwise. 838N/A // The top level in a zip file is always a directory. 838N/A // entry is not compressed? 0N/A // is this compressed - offset 8 in the ZipEntry header 0N/A // entry is not compressed? 0N/A //---------------------------------------------------------------------------- 0N/A //---------------------------------------------------------------------------- 0N/A throw new ZipException(
"encrypted zip file");
// offset 6 in the header of the ZipFileEntry 0N/A * Inflate using the java.util.zip.Inflater class 0N/A // construct the inflater object or reuse an existing one 0N/A * return the two bytes buf[pos], buf[pos+1] as an unsigned integer in little 0N/A * return the 4 bytes buf[i..i+3] as an integer in little endian format. 0N/A /* ---------------------------------------------------------------------------- 0N/A * ----------------------------------------------------------------------------*/ 922N/A * the zip entry signature should be at offset 0, otherwise allow the 922N/A * calling logic to take evasive action by throwing ZipFormatException. 0N/A * Reads zip file central directory. 0N/A * For more details see readCEN in zip_util.c from the JDK sources. 0N/A * This is a Java port of that function. 0N/A // There is a variable-length field after the dir offset record. We need to do consequential search. 922N/A // a negative offset or the entries field indicates a 922N/A // potential zip64 archive 0N/A // Add each of the files 0N/A // Add the accumulated dirs into the same list 102N/A // use shared RelativeDirectory objects for parent dirs 102N/A // Force any '\' to '/'. Keep the position of the last separator. 0N/A // Enter also all the parent directories 102N/A // use shared RelativeDirectory objects for parent dirs 0N/A // For each dir create also a file 0N/A * Returns the last modified timestamp of a zip file. 0N/A /** ------------------------------------------------------------------------ 0N/A * DirectoryEntry class 0N/A * -------------------------------------------------------------------------*/ 0N/A // Read the name bytes 0N/A // Read offset of bytes in the real Jar/Zip file 0N/A // Read size of the file in the real Jar/Zip file 0N/A // Read compressed size of the file in the real Jar/Zip file 0N/A // Read java time stamp of the file in the real Jar/Zip file 0N/A // Write the dir name bytes 0N/A // Write the number of files in the dir 0N/A // Write the offset of the file's data in the dir 0N/A // Fix up the offset in the directory table 0N/A // Now write each of the files in the DirectoryEntry 0N/A // Write the name bytes 0N/A // Write offset of bytes in the real Jar/Zip file 0N/A // Write size of the file in the real Jar/Zip file 0N/A // Write compressed size of the file in the real Jar/Zip file 0N/A // Write java time stamp of the file in the real Jar/Zip file 56N/A // Directory related 70N/A // based on dosToJavaTime in java.util.Zip, but avoiding the 70N/A // use of deprecated Date constructor 922N/A * Exception primarily used to implement a failover, used exclusively here.