1 16 17 package de.schlichtherle.util.zip; 18 19 import de.schlichtherle.io.rof.ReadOnlyFile; 20 import de.schlichtherle.io.util.SynchronizedInputStream; 21 22 import java.io.File ; 23 import java.io.FileNotFoundException ; 24 import java.io.IOException ; 25 import java.io.InputStream ; 26 import java.io.UnsupportedEncodingException ; 27 import java.util.Collections ; 28 import java.util.Enumeration ; 29 import java.util.zip.ZipException ; 30 31 53 public class ZipFile extends BasicZipFile { 54 55 66 public ZipFile(String name) 67 throws NullPointerException , 68 FileNotFoundException , 69 ZipException , 70 IOException { 71 super(name); 72 } 73 74 89 public ZipFile(String name, String encoding) 90 throws NullPointerException , 91 UnsupportedEncodingException , 92 FileNotFoundException , 93 ZipException , 94 IOException { 95 super(name, encoding); 96 } 97 98 135 public ZipFile( 136 String name, 137 String encoding, 138 boolean preambled, 139 boolean postambled) 140 throws NullPointerException , 141 UnsupportedEncodingException , 142 FileNotFoundException , 143 ZipException , 144 IOException { 145 super(name, encoding, preambled, postambled); 146 } 147 148 159 public ZipFile(File file) 160 throws NullPointerException , 161 FileNotFoundException , 162 ZipException , 163 IOException { 164 super(file); 165 } 166 167 183 public ZipFile(File file, String encoding) 184 throws NullPointerException , 185 UnsupportedEncodingException , 186 FileNotFoundException , 187 ZipException , 188 IOException { 189 super(file, encoding); 190 } 191 192 230 public ZipFile( 231 File file, 232 String encoding, 233 boolean preambled, 234 boolean postambled) 235 throws NullPointerException , 236 UnsupportedEncodingException , 237 FileNotFoundException , 238 ZipException , 239 IOException { 240 super(file, encoding, preambled, postambled); 241 } 242 243 255 public ZipFile(ReadOnlyFile rof) 256 throws NullPointerException , 257 FileNotFoundException , 258 ZipException , 259 IOException { 260 super(rof); 261 } 262 263 280 public ZipFile(ReadOnlyFile rof, String encoding) 281 throws NullPointerException , 282 UnsupportedEncodingException , 283 FileNotFoundException , 284 ZipException , 285 IOException { 286 super(rof, encoding); 287 } 288 289 328 public ZipFile( 329 ReadOnlyFile rof, 330 String encoding, 331 boolean preambled, 332 boolean postambled) 333 throws NullPointerException , 334 UnsupportedEncodingException , 335 FileNotFoundException , 336 ZipException , 337 IOException { 338 super(rof, encoding, preambled, postambled); 339 } 340 341 348 public synchronized Enumeration entries() { 349 return new Enumeration () { 350 Enumeration e = Collections.enumeration(Collections.list( 351 ZipFile.super.entries())); 352 353 public boolean hasMoreElements() { 354 return e.hasMoreElements(); 355 } 356 357 public Object nextElement() { 358 return ((ZipEntry) e.nextElement()).clone(); 359 } 360 }; 361 } 362 363 369 public synchronized ZipEntry getEntry(String name) { 370 ZipEntry ze = super.getEntry(name); 371 return ze != null ? (ZipEntry) ze.clone() : null; 372 } 373 374 public synchronized InputStream getPreambleInputStream() throws IOException { 375 return new SynchronizedInputStream( 376 super.getPreambleInputStream(), 377 this); 378 } 379 380 public synchronized InputStream getPostambleInputStream() throws IOException { 381 return new SynchronizedInputStream( 382 super.getPostambleInputStream(), 383 this); 384 } 385 386 public synchronized boolean busy() { 387 return super.busy(); 388 } 389 390 protected synchronized InputStream getInputStream( 391 final String name, 392 final boolean check, 393 final boolean inflate) 394 throws IOException { 395 return new SynchronizedInputStream( 396 super.getInputStream(name, check, inflate), 397 this); 398 } 399 400 public synchronized void close() throws IOException { 401 super.close(); 402 } 403 } 404 | Popular Tags |