/** * Constructs a new {@code ZipFile} allowing access to the given file. * The {@code mode} must be either {@code OPEN_READ} or {@code OPEN_READ|OPEN_DELETE}. * * <p>If the {@code OPEN_DELETE} flag is supplied, the file will be deleted at or before the * time that the {@code ZipFile} is closed (the contents will remain accessible until * this {@code ZipFile} is closed); it also calls {@code File.deleteOnExit}. * * @throws IOException if an {@code IOException} occurs. */ public ZipFile(File file, int mode) throws IOException { filename = file.getPath(); if (mode != OPEN_READ && mode != (OPEN_READ | OPEN_DELETE)) { throw new IllegalArgumentException("Bad mode: " + mode); } if ((mode & OPEN_DELETE) != 0) { fileToDeleteOnClose = file; fileToDeleteOnClose.deleteOnExit(); } else { fileToDeleteOnClose = null; } raf = new RandomAccessFile(filename, "r"); readCentralDir(); guard.open("close"); }
/** * Constructs a new {@code ZipFile} allowing access to the given file. * The {@code mode} must be either {@code OPEN_READ} or {@code OPEN_READ|OPEN_DELETE}. * * <p>If the {@code OPEN_DELETE} flag is supplied, the file will be deleted at or before the * time that the {@code ZipFile} is closed (the contents will remain accessible until * this {@code ZipFile} is closed); it also calls {@code File.deleteOnExit}. * * @throws IOException if an {@code IOException} occurs. */ public ZipFile(File file, int mode) throws IOException { filename = file.getPath(); if (mode != OPEN_READ && mode != (OPEN_READ | OPEN_DELETE)) { throw new IllegalArgumentException("Bad mode: " + mode); } if ((mode & OPEN_DELETE) != 0) { fileToDeleteOnClose = file; fileToDeleteOnClose.deleteOnExit(); } else { fileToDeleteOnClose = null; } raf = new RandomAccessFile(filename, "r"); readCentralDir(); guard.open("close"); }
/** * Constructs a new {@code ZipFile} allowing access to the given file. * The {@code mode} must be either {@code OPEN_READ} or {@code OPEN_READ|OPEN_DELETE}. * * <p>If the {@code OPEN_DELETE} flag is supplied, the file will be deleted at or before the * time that the {@code ZipFile} is closed (the contents will remain accessible until * this {@code ZipFile} is closed); it also calls {@code File.deleteOnExit}. * * @throws IOException if an {@code IOException} occurs. */ public ZipFile(File file, int mode) throws IOException { filename = file.getPath(); if (mode != OPEN_READ && mode != (OPEN_READ | OPEN_DELETE)) { throw new IllegalArgumentException("Bad mode: " + mode); } if ((mode & OPEN_DELETE) != 0) { fileToDeleteOnClose = file; fileToDeleteOnClose.deleteOnExit(); } else { fileToDeleteOnClose = null; } raf = new RandomAccessFile(filename, "r"); readCentralDir(); guard.open("close"); }
/** * Constructs a new {@code ZipFile} allowing access to the given file. * The {@code mode} must be either {@code OPEN_READ} or {@code OPEN_READ|OPEN_DELETE}. * * <p>If the {@code OPEN_DELETE} flag is supplied, the file will be deleted at or before the * time that the {@code ZipFile} is closed (the contents will remain accessible until * this {@code ZipFile} is closed); it also calls {@code File.deleteOnExit}. * * @throws IOException if an {@code IOException} occurs. */ public ZipFile(File file, int mode) throws IOException { filename = file.getPath(); if (mode != OPEN_READ && mode != (OPEN_READ | OPEN_DELETE)) { throw new IllegalArgumentException("Bad mode: " + mode); } if ((mode & OPEN_DELETE) != 0) { fileToDeleteOnClose = file; fileToDeleteOnClose.deleteOnExit(); } else { fileToDeleteOnClose = null; } raf = new RandomAccessFile(filename, "r"); readCentralDir(); guard.open("close"); }
/** * Constructs a new {@code ZipFile} allowing access to the given file. * The {@code mode} must be either {@code OPEN_READ} or {@code OPEN_READ|OPEN_DELETE}. * * <p>If the {@code OPEN_DELETE} flag is supplied, the file will be deleted at or before the * time that the {@code ZipFile} is closed (the contents will remain accessible until * this {@code ZipFile} is closed); it also calls {@code File.deleteOnExit}. * * @throws IOException if an {@code IOException} occurs. */ public ZipFile(File file, int mode) throws IOException { filename = file.getPath(); if (mode != OPEN_READ && mode != (OPEN_READ | OPEN_DELETE)) { throw new IllegalArgumentException("Bad mode: " + mode); } if ((mode & OPEN_DELETE) != 0) { fileToDeleteOnClose = file; fileToDeleteOnClose.deleteOnExit(); } else { fileToDeleteOnClose = null; } raf = new RandomAccessFile(filename, "r"); readCentralDir(); guard.open("close"); }
/** * Constructs a new {@code ZipFile} allowing access to the given file. * The {@code mode} must be either {@code OPEN_READ} or {@code OPEN_READ|OPEN_DELETE}. * <p> * <p>If the {@code OPEN_DELETE} flag is supplied, the file will be deleted at or before the * time that the {@code ZipFile} is closed (the contents will remain accessible until * this {@code ZipFile} is closed); it also calls {@code File.deleteOnExit}. * * @throws IOException if an {@code IOException} occurs. */ public ZipFile(File file, int mode) throws IOException { filename = file.getPath(); if (mode != OPEN_READ && mode != (OPEN_READ | OPEN_DELETE)) { throw new IllegalArgumentException("Bad mode: " + mode); } if ((mode & OPEN_DELETE) != 0) { fileToDeleteOnClose = file; fileToDeleteOnClose.deleteOnExit(); } else { fileToDeleteOnClose = null; } ras = new RAFile(file); readCentralDir(); }
/** * Constructs a new {@code ZipFile} allowing access to the given file. * The {@code mode} must be either {@code OPEN_READ} or {@code OPEN_READ|OPEN_DELETE}. * * <p>If the {@code OPEN_DELETE} flag is supplied, the file will be deleted at or before the * time that the {@code ZipFile} is closed (the contents will remain accessible until * this {@code ZipFile} is closed); it also calls {@code File.deleteOnExit}. * * @throws IOException if an {@code IOException} occurs. */ public ZipFile(File file, int mode) throws IOException { filename = file.getPath(); if (mode != OPEN_READ && mode != (OPEN_READ | OPEN_DELETE)) { throw new IllegalArgumentException("Bad mode: " + mode); } if ((mode & OPEN_DELETE) != 0) { fileToDeleteOnClose = file; fileToDeleteOnClose.deleteOnExit(); } else { fileToDeleteOnClose = null; } raf = new RandomAccessFile(filename, "r"); readCentralDir(); guard.open("close"); }
/** * Constructs a new {@code ZipFile} allowing access to the given file. * The {@code mode} must be either {@code OPEN_READ} or {@code OPEN_READ|OPEN_DELETE}. * * <p>If the {@code OPEN_DELETE} flag is supplied, the file will be deleted at or before the * time that the {@code ZipFile} is closed (the contents will remain accessible until * this {@code ZipFile} is closed); it also calls {@code File.deleteOnExit}. * * @throws IOException if an {@code IOException} occurs. */ public ZipFile(File file, int mode) throws IOException { filename = file.getPath(); if (mode != OPEN_READ && mode != (OPEN_READ | OPEN_DELETE)) { throw new IllegalArgumentException("Bad mode: " + mode); } if ((mode & OPEN_DELETE) != 0) { fileToDeleteOnClose = file; fileToDeleteOnClose.deleteOnExit(); } else { fileToDeleteOnClose = null; } raf = new RandomAccessFile(filename, "r"); readCentralDir(); guard.open("close"); }