< prev index next >
src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JarArchive.java
Print this page
*** 41,51 ****
public abstract class JarArchive implements Archive {
/**
* An entry located in a jar file.
*/
! private class JarEntry extends Entry {
private final long size;
private final ZipEntry entry;
private final ZipFile file;
--- 41,51 ----
public abstract class JarArchive implements Archive {
/**
* An entry located in a jar file.
*/
! public class JarEntry extends Entry {
private final long size;
private final ZipEntry entry;
private final ZipFile file;
*** 68,83 ****
public InputStream stream() throws IOException {
return file.getInputStream(entry);
}
}
- private static final String MODULE_INFO = "module-info.class";
-
private final Path file;
private final String moduleName;
// currently processed ZipFile
! private ZipFile zipFile;
protected JarArchive(String mn, Path file) {
Objects.requireNonNull(mn);
Objects.requireNonNull(file);
this.moduleName = mn;
--- 68,81 ----
public InputStream stream() throws IOException {
return file.getInputStream(entry);
}
}
private final Path file;
private final String moduleName;
// currently processed ZipFile
! protected ZipFile zipFile;
protected JarArchive(String mn, Path file) {
Objects.requireNonNull(mn);
Objects.requireNonNull(file);
this.moduleName = mn;
*** 108,132 ****
abstract EntryType toEntryType(String entryName);
abstract String getFileName(String entryName);
! private Entry toEntry(ZipEntry ze) {
! String name = ze.getName();
! String fn = getFileName(name);
!
! if (ze.isDirectory() || fn.startsWith("_")) {
! return null;
! }
!
! EntryType rt = toEntryType(name);
!
! if (fn.equals(MODULE_INFO)) {
! fn = moduleName + "/" + MODULE_INFO;
! }
! return new JarEntry(ze.getName(), fn, rt, zipFile, ze);
! }
@Override
public void close() throws IOException {
if (zipFile != null) {
zipFile.close();
--- 106,116 ----
abstract EntryType toEntryType(String entryName);
abstract String getFileName(String entryName);
! abstract Entry toEntry(ZipEntry ze);
@Override
public void close() throws IOException {
if (zipFile != null) {
zipFile.close();
< prev index next >