()
| 317 | } |
| 318 | |
| 319 | public void closeEntry() throws IOException { |
| 320 | if (currentHeader == null) { |
| 321 | return; |
| 322 | } |
| 323 | topOutput.close(); |
| 324 | |
| 325 | currentHeader.crc = topOutput.getCrc(); |
| 326 | currentHeader.compressedSize = bottomOutput.getCount(); |
| 327 | currentHeader.size = topOutput.getCount(); |
| 328 | |
| 329 | long saved = _getFilePointer(); |
| 330 | _seek(currentHeader.headerOffset + WORD + SHORT + SHORT + SHORT + WORD); |
| 331 | _writeInt(currentHeader.crc); |
| 332 | if (currentHeader.sizeNeedZip64) { |
| 333 | _writeUInt(MAX_ZIP_ENTRY_AND_ARCHIVE_SIZE); |
| 334 | _writeUInt(MAX_ZIP_ENTRY_AND_ARCHIVE_SIZE); |
| 335 | |
| 336 | // skip nameLength + extraLength + nameData |
| 337 | _skip(SHORT + SHORT + currentHeader.name.length); |
| 338 | |
| 339 | // skip zip64Extra(header + size) |
| 340 | _skip(4); |
| 341 | |
| 342 | // update local extra |
| 343 | _writeLong(currentHeader.size); |
| 344 | _writeLong(currentHeader.compressedSize); |
| 345 | } else { |
| 346 | if (currentHeader.compressedSize >= MAX_ZIP_ENTRY_AND_ARCHIVE_SIZE || |
| 347 | currentHeader.size >= MAX_ZIP_ENTRY_AND_ARCHIVE_SIZE) { |
| 348 | throw new IOException("Zip entry size needs zip64: name=" + new String(currentHeader.name) |
| 349 | + ", compressedSize=" + currentHeader.compressedSize |
| 350 | + ", size=" + currentHeader.size |
| 351 | ); |
| 352 | } |
| 353 | _writeUInt(currentHeader.compressedSize); |
| 354 | _writeUInt(currentHeader.size); |
| 355 | } |
| 356 | |
| 357 | archive.seek(saved); |
| 358 | |
| 359 | topOutput = null; |
| 360 | bottomOutput = null; |
| 361 | currentHeader = null; |
| 362 | } |
| 363 | |
| 364 | @Override |
| 365 | public void close() throws IOException { |
no test coverage detected