1.1 --- a/src/share/classes/com/sun/tools/javac/file/ZipArchive.java Wed Sep 23 18:29:41 2009 -0700 1.2 +++ b/src/share/classes/com/sun/tools/javac/file/ZipArchive.java Wed Sep 23 18:48:13 2009 -0700 1.3 @@ -147,51 +147,37 @@ 1.4 this.entry = entry; 1.5 } 1.6 1.7 + public URI toUri() { 1.8 + File zipFile = new File(zarch.zdir.getName()); 1.9 + return createJarUri(zipFile, entry.getName()); 1.10 + } 1.11 + 1.12 + @Override 1.13 + public String getName() { 1.14 + return zarch.zdir.getName() + "(" + entry.getName() + ")"; 1.15 + } 1.16 + 1.17 + @Override 1.18 + public String getShortName() { 1.19 + return new File(zarch.zdir.getName()).getName() + "(" + entry + ")"; 1.20 + } 1.21 + 1.22 + @Override 1.23 + public JavaFileObject.Kind getKind() { 1.24 + return getKind(entry.getName()); 1.25 + } 1.26 + 1.27 + @Override 1.28 public InputStream openInputStream() throws IOException { 1.29 return zarch.zdir.getInputStream(entry); 1.30 } 1.31 1.32 + @Override 1.33 public OutputStream openOutputStream() throws IOException { 1.34 throw new UnsupportedOperationException(); 1.35 } 1.36 1.37 @Override 1.38 - protected CharsetDecoder getDecoder(boolean ignoreEncodingErrors) { 1.39 - return fileManager.getDecoder(fileManager.getEncodingName(), ignoreEncodingErrors); 1.40 - } 1.41 - 1.42 - public Writer openWriter() throws IOException { 1.43 - throw new UnsupportedOperationException(); 1.44 - } 1.45 - 1.46 - @Deprecated 1.47 - public String getName() { 1.48 - return name; 1.49 - } 1.50 - 1.51 - public boolean isNameCompatible(String cn, JavaFileObject.Kind k) { 1.52 - cn.getClass(); 1.53 - // null check 1.54 - if (k == Kind.OTHER && getKind() != k) { 1.55 - return false; 1.56 - } 1.57 - return name.equals(cn + k.extension); 1.58 - } 1.59 - 1.60 - @Deprecated 1.61 - @Override 1.62 - public String getPath() { 1.63 - return zarch.zdir.getName() + "(" + entry + ")"; 1.64 - } 1.65 - 1.66 - public long getLastModified() { 1.67 - return entry.getTime(); 1.68 - } 1.69 - 1.70 - public boolean delete() { 1.71 - throw new UnsupportedOperationException(); 1.72 - } 1.73 - 1.74 public CharBuffer getCharContent(boolean ignoreEncodingErrors) throws IOException { 1.75 CharBuffer cb = fileManager.getCachedContent(this); 1.76 if (cb == null) { 1.77 @@ -216,6 +202,42 @@ 1.78 } 1.79 1.80 @Override 1.81 + public Writer openWriter() throws IOException { 1.82 + throw new UnsupportedOperationException(); 1.83 + } 1.84 + 1.85 + @Override 1.86 + public long getLastModified() { 1.87 + return entry.getTime(); 1.88 + } 1.89 + 1.90 + @Override 1.91 + public boolean delete() { 1.92 + throw new UnsupportedOperationException(); 1.93 + } 1.94 + 1.95 + @Override 1.96 + protected CharsetDecoder getDecoder(boolean ignoreEncodingErrors) { 1.97 + return fileManager.getDecoder(fileManager.getEncodingName(), ignoreEncodingErrors); 1.98 + } 1.99 + 1.100 + @Override 1.101 + protected String inferBinaryName(Iterable<? extends File> path) { 1.102 + String entryName = entry.getName(); 1.103 + return removeExtension(entryName).replace('/', '.'); 1.104 + } 1.105 + 1.106 + @Override 1.107 + public boolean isNameCompatible(String cn, JavaFileObject.Kind k) { 1.108 + cn.getClass(); 1.109 + // null check 1.110 + if (k == Kind.OTHER && getKind() != k) { 1.111 + return false; 1.112 + } 1.113 + return name.equals(cn + k.extension); 1.114 + } 1.115 + 1.116 + @Override 1.117 public boolean equals(Object other) { 1.118 if (!(other instanceof ZipFileObject)) { 1.119 return false; 1.120 @@ -228,25 +250,6 @@ 1.121 public int hashCode() { 1.122 return zarch.zdir.hashCode() + name.hashCode(); 1.123 } 1.124 - 1.125 - public String getZipName() { 1.126 - return zarch.zdir.getName(); 1.127 - } 1.128 - 1.129 - public String getZipEntryName() { 1.130 - return entry.getName(); 1.131 - } 1.132 - 1.133 - public URI toUri() { 1.134 - File zipFile = new File(getZipName()); 1.135 - return createJarUri(zipFile, entry.getName()); 1.136 - } 1.137 - 1.138 - @Override 1.139 - protected String inferBinaryName(Iterable<? extends File> path) { 1.140 - String entryName = getZipEntryName(); 1.141 - return removeExtension(entryName).replace('/', '.'); 1.142 - } 1.143 } 1.144 1.145 }