--- a/langtools/src/share/classes/com/sun/tools/javac/file/ZipFileIndexArchive.java Wed Jul 05 17:01:15 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/file/ZipFileIndexArchive.java Fri Sep 25 22:04:43 2009 -0700
@@ -123,88 +123,41 @@
this.zipName = zipFileName;
}
- public InputStream openInputStream() throws IOException {
+ @Override
+ public URI toUri() {
+ return createJarUri(zipName, getPrefixedEntryName());
+ }
+
+ @Override
+ public String getName() {
+ return zipName + "(" + getPrefixedEntryName() + ")";
+ }
+ @Override
+ public String getShortName() {
+ return zipName.getName() + "(" + entry.getName() + ")";
+ }
+
+ @Override
+ public JavaFileObject.Kind getKind() {
+ return getKind(entry.getName());
+ }
+
+ @Override
+ public InputStream openInputStream() throws IOException {
if (inputStream == null) {
- inputStream = new ByteArrayInputStream(read());
+ assert entry != null; // see constructor
+ inputStream = new ByteArrayInputStream(zfIndex.read(entry));
}
return inputStream;
}
@Override
- protected CharsetDecoder getDecoder(boolean ignoreEncodingErrors) {
- return fileManager.getDecoder(fileManager.getEncodingName(), ignoreEncodingErrors);
- }
-
public OutputStream openOutputStream() throws IOException {
throw new UnsupportedOperationException();
}
- public Writer openWriter() throws IOException {
- throw new UnsupportedOperationException();
- }
-
- /** @deprecated see bug 6410637 */
- @Deprecated
- public String getName() {
- return name;
- }
-
- public boolean isNameCompatible(String cn, JavaFileObject.Kind k) {
- cn.getClass(); // null check
- if (k == Kind.OTHER && getKind() != k)
- return false;
- return name.equals(cn + k.extension);
- }
-
- /** @deprecated see bug 6410637 */
- @Deprecated
@Override
- public String getPath() {
- return zipName + "(" + entry.getName() + ")";
- }
-
- public long getLastModified() {
- return entry.getLastModified();
- }
-
- public boolean delete() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public boolean equals(Object other) {
- if (!(other instanceof ZipFileIndexFileObject))
- return false;
- ZipFileIndexFileObject o = (ZipFileIndexFileObject) other;
- return entry.equals(o.entry);
- }
-
- @Override
- public int hashCode() {
- return zipName.hashCode() + (name.hashCode() << 10);
- }
-
- public String getZipName() {
- return zipName.getPath();
- }
-
- public String getZipEntryName() {
- return entry.getName();
- }
-
- public URI toUri() {
- if (zfIndex.symbolFilePrefix != null)
- return createJarUri(zipName, zfIndex.symbolFilePrefix.path + entry.getName());
- else
- return createJarUri(zipName, entry.getName());
- }
-
- private byte[] read() throws IOException {
- assert entry != null; // see constructor
- return zfIndex.read(entry);
- }
-
public CharBuffer getCharContent(boolean ignoreEncodingErrors) throws IOException {
CharBuffer cb = fileManager.getCachedContent(this);
if (cb == null) {
@@ -228,8 +181,28 @@
}
@Override
+ public Writer openWriter() throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public long getLastModified() {
+ return entry.getLastModified();
+ }
+
+ @Override
+ public boolean delete() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ protected CharsetDecoder getDecoder(boolean ignoreEncodingErrors) {
+ return fileManager.getDecoder(fileManager.getEncodingName(), ignoreEncodingErrors);
+ }
+
+ @Override
protected String inferBinaryName(Iterable<? extends File> path) {
- String entryName = getZipEntryName();
+ String entryName = entry.getName();
if (zfIndex.symbolFilePrefix != null) {
String prefix = zfIndex.symbolFilePrefix.path;
if (entryName.startsWith(prefix))
@@ -237,6 +210,34 @@
}
return removeExtension(entryName).replace('/', '.');
}
+
+ @Override
+ public boolean isNameCompatible(String cn, JavaFileObject.Kind k) {
+ cn.getClass(); // null check
+ if (k == Kind.OTHER && getKind() != k)
+ return false;
+ return name.equals(cn + k.extension);
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (!(other instanceof ZipFileIndexFileObject))
+ return false;
+ ZipFileIndexFileObject o = (ZipFileIndexFileObject) other;
+ return entry.equals(o.entry);
+ }
+
+ @Override
+ public int hashCode() {
+ return zipName.hashCode() + (name.hashCode() << 10);
+ }
+
+ private String getPrefixedEntryName() {
+ if (zfIndex.symbolFilePrefix != null)
+ return zfIndex.symbolFilePrefix.path + entry.getName();
+ else
+ return entry.getName();
+ }
}
}