144 |
private void checkZipFile() throws IOException, ZipException |
private void checkZipFile() throws IOException, ZipException |
145 |
{ |
{ |
146 |
byte[] magicBuf = new byte[4]; |
byte[] magicBuf = new byte[4]; |
147 |
raf.read(magicBuf); |
boolean validRead = true; |
148 |
|
|
149 |
if (readLeInt(magicBuf, 0) != LOCSIG) |
try |
150 |
|
{ |
151 |
|
raf.readFully(magicBuf); |
152 |
|
} |
153 |
|
catch (EOFException eof) |
154 |
|
{ |
155 |
|
validRead = false; |
156 |
|
} |
157 |
|
|
158 |
|
if (validRead == false || readLeInt(magicBuf, 0) != LOCSIG) |
159 |
{ |
{ |
160 |
raf.close(); |
raf.close(); |
161 |
throw new ZipException("Not a valid zip file"); |
throw new ZipException("Not a valid zip file"); |
386 |
* Checks that the ZipFile is still open and reads entries when necessary. |
* Checks that the ZipFile is still open and reads entries when necessary. |
387 |
* |
* |
388 |
* @exception IllegalStateException when the ZipFile has already been closed. |
* @exception IllegalStateException when the ZipFile has already been closed. |
389 |
* @exception IOEexception when the entries could not be read. |
* @exception IOException when the entries could not be read. |
390 |
*/ |
*/ |
391 |
private HashMap getEntries() throws IOException |
private HashMap getEntries() throws IOException |
392 |
{ |
{ |
404 |
/** |
/** |
405 |
* Searches for a zip entry in this archive with the given name. |
* Searches for a zip entry in this archive with the given name. |
406 |
* |
* |
407 |
* @param the name. May contain directory components separated by |
* @param name the name. May contain directory components separated by |
408 |
* slashes ('/'). |
* slashes ('/'). |
409 |
* @return the zip entry, or null if no entry with that name exists. |
* @return the zip entry, or null if no entry with that name exists. |
410 |
* |
* |