changeset in /hg/icedtea6: Final fix to get NIO2 to build.

Andrew John Hughes ahughes at redhat.com
Tue Feb 3 04:14:00 PST 2009


changeset 945a4627e256 in /hg/icedtea6
details: http://icedtea.classpath.org/hg/icedtea6?cmd=changeset;node=945a4627e256
description:
	Final fix to get NIO2 to build.

	2009-01-27  Andrew John Hughes  <ahughes at redhat.com>

		* overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/java/nio/channels/FileChannel.java:
		Use org.classpath.icedtea.java.nio.channels.FileChannel.
		* overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/java/nio/file/spi/FileSystemProvider.java:
		Likewise.
		* overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/META-INF/services/java.nio.file.spi.FileSystemProvider,
		* overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/README.txt,
		* overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/JarEntryInfo.java,
		* overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/JarFileAttributeView.java,
		* overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/JarFileAttributes.java,
		* overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/ZipEntryInfo.java,
		* overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/ZipFileAttributeView.java,
		* overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/ZipFileAttributes.java,
		* overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/ZipFileBasicAttributeView.java,
		* overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/ZipFileBasicAttributes.java,
		* overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/ZipFilePath.java,
		* overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/ZipFileStore.java,
		* overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/ZipFileStream.java,
		* overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/ZipFileSystem.java,
		* overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/ZipFileSystemProvider.java,
		* overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/ZipHeaderConstants.java,
		* overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/ZipPathParser.java,
		* overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/ZipUtils.java:
		Import NIO2 demo and fix imports.
		* overlays/nio2/openjdk/jdk/src/solaris/classes/sun/nio/fs/UnixFileSystemProvider.java:
		Use org.classpath.icedtea.java.nio.channels.FileChannel.

diffstat:

22 files changed, 3725 insertions(+), 6 deletions(-)
ChangeLog                                                                                                         |   28 
overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/java/nio/channels/FileChannel.java              |    8 
overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/java/nio/file/spi/FileSystemProvider.java       |    2 
overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/META-INF/services/java.nio.file.spi.FileSystemProvider |    1 
overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/README.txt                                             |   29 
overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/JarEntryInfo.java                    |   44 
overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/JarFileAttributeView.java            |   76 
overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/JarFileAttributes.java               |   57 
overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/ZipEntryInfo.java                    |   76 
overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/ZipFileAttributeView.java            |  154 +
overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/ZipFileAttributes.java               |   93 
overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/ZipFileBasicAttributeView.java       |  187 +
overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/ZipFileBasicAttributes.java          |  125 +
overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/ZipFilePath.java                     | 1027 ++++++++++
overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/ZipFileStore.java                    |  230 ++
overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/ZipFileStream.java                   |  166 +
overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/ZipFileSystem.java                   |  319 +++
overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/ZipFileSystemProvider.java           |  243 ++
overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/ZipHeaderConstants.java              |   75 
overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/ZipPathParser.java                   |  308 ++
overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/ZipUtils.java                        |  481 ++++
overlays/nio2/openjdk/jdk/src/solaris/classes/sun/nio/fs/UnixFileSystemProvider.java                              |    2 

diffs (truncated from 3860 to 500 lines):

diff -r d57abf1d1d65 -r 945a4627e256 ChangeLog
--- a/ChangeLog	Tue Jan 27 11:54:55 2009 +0000
+++ b/ChangeLog	Wed Jan 28 00:27:48 2009 +0000
@@ -1,3 +1,31 @@ 2009-01-27  Andrew John Hughes  <ahughes
+2009-01-27  Andrew John Hughes  <ahughes at redhat.com>
+
+	* overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/java/nio/channels/FileChannel.java:
+	Use org.classpath.icedtea.java.nio.channels.FileChannel.
+	* overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/java/nio/file/spi/FileSystemProvider.java:
+	Likewise.
+	* overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/META-INF/services/java.nio.file.spi.FileSystemProvider,
+	* overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/README.txt,
+	* overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/JarEntryInfo.java,
+	* overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/JarFileAttributeView.java,
+	* overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/JarFileAttributes.java,
+	* overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/ZipEntryInfo.java,
+	* overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/ZipFileAttributeView.java,
+	* overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/ZipFileAttributes.java,
+	* overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/ZipFileBasicAttributeView.java,
+	* overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/ZipFileBasicAttributes.java,
+	* overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/ZipFilePath.java,
+	* overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/ZipFileStore.java,
+	* overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/ZipFileStream.java,
+	* overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/ZipFileSystem.java,
+	* overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/ZipFileSystemProvider.java,
+	* overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/ZipHeaderConstants.java,
+	* overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/ZipPathParser.java,
+	* overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/ZipUtils.java:
+	Import NIO2 demo and fix imports.
+	* overlays/nio2/openjdk/jdk/src/solaris/classes/sun/nio/fs/UnixFileSystemProvider.java:
+	Use org.classpath.icedtea.java.nio.channels.FileChannel.
+
 2009-01-27  Andrew John Hughes  <ahughes at redhat.com>
 
 	* overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/java/nio/channels/FileChannel.java:
diff -r d57abf1d1d65 -r 945a4627e256 overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/java/nio/channels/FileChannel.java
--- a/overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/java/nio/channels/FileChannel.java	Tue Jan 27 11:54:55 2009 +0000
+++ b/overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/java/nio/channels/FileChannel.java	Wed Jan 28 00:27:48 2009 +0000
@@ -288,9 +288,9 @@ public abstract class FileChannel
      *
      * @since   1.7
      */
-    public static java.nio.channels.FileChannel open(Path file,
-						     Set<? extends OpenOption> options,
-						     FileAttribute<?>... attrs)
+    public static FileChannel open(Path file,
+				   Set<? extends OpenOption> options,
+				   FileAttribute<?>... attrs)
         throws IOException
     {
         FileSystemProvider provider = file.getFileSystem().provider();
@@ -335,7 +335,7 @@ public abstract class FileChannel
      *
      * @since   1.7
      */
-    public static java.nio.channels.FileChannel open(Path file, OpenOption... options)
+    public static FileChannel open(Path file, OpenOption... options)
         throws IOException
     {
         Set<OpenOption> set = new HashSet<OpenOption>(options.length);
diff -r d57abf1d1d65 -r 945a4627e256 overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/java/nio/file/spi/FileSystemProvider.java
--- a/overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/java/nio/file/spi/FileSystemProvider.java	Tue Jan 27 11:54:55 2009 +0000
+++ b/overlays/nio2/openjdk/jdk/src/share/classes/org/classpath/icedtea/java/nio/file/spi/FileSystemProvider.java	Wed Jan 28 00:27:48 2009 +0000
@@ -26,7 +26,6 @@
 
 package org.classpath.icedtea.java.nio.file.spi;
 
-import java.nio.channels.*;
 import java.net.URI;
 import java.util.*;
 import java.util.concurrent.ExecutorService;
@@ -35,6 +34,7 @@ import java.io.IOException;
 import java.io.IOException;
 
 import org.classpath.icedtea.java.nio.channels.AsynchronousFileChannel;
+import org.classpath.icedtea.java.nio.channels.FileChannel;
 import org.classpath.icedtea.java.nio.file.FileRef;
 import org.classpath.icedtea.java.nio.file.FileSystem;
 import org.classpath.icedtea.java.nio.file.FileSystems;
diff -r d57abf1d1d65 -r 945a4627e256 overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/META-INF/services/java.nio.file.spi.FileSystemProvider
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/META-INF/services/java.nio.file.spi.FileSystemProvider	Wed Jan 28 00:27:48 2009 +0000
@@ -0,0 +1,1 @@
+com.sun.nio.zipfs.ZipFileSystemProvider
\ No newline at end of file
diff -r d57abf1d1d65 -r 945a4627e256 overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/README.txt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/README.txt	Wed Jan 28 00:27:48 2009 +0000
@@ -0,0 +1,29 @@
+ZipFileSystem is a file system provider that treats the contents of a zip or
+JAR file as a read-only file system.
+
+To deploy the provider you must copy ZipFileSystem.jar into your extensions
+directory or else add <JDK_HOME>/demo/nio/ZipFileSystem/ZipFileSystem.jar
+to your class path.
+
+The factory methods defined by the java.nio.file.FileSystems class can be
+used to create a FileSystem, eg:
+
+   // use file type detection
+   Map<String,?> env = Collections.emptyMap();
+   Path jarfile = Path.get("foo.jar");
+   FileSystem fs = FileSystems.newFileSystem(jarfile, env);
+
+-or
+
+   // locate file system by URI
+   Map<String,?> env = Collections.emptyMap();
+   URI uri = URI.create("zip:///mydir/foo.jar");
+   FileSystem fs = FileSystems.newFileSystem(uri, env);
+
+Once a FileSystem is created then classes in the java.nio.file package
+can be used to access files in the zip/JAR file, eg:
+
+   Path mf = fs.getPath("/META-INF/MANIFEST.MF");
+   InputStream in = mf.newInputStream();
+
+
diff -r d57abf1d1d65 -r 945a4627e256 overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/JarEntryInfo.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/JarEntryInfo.java	Wed Jan 28 00:27:48 2009 +0000
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2007-2008 Sun Microsystems, Inc.  All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *   - Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *
+ *   - Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ *   - Neither the name of Sun Microsystems nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package com.sun.nio.zipfs;
+
+import java.util.Map;
+import java.util.Set;
+
+public class JarEntryInfo extends ZipEntryInfo {
+    JarEntryInfo(ZipEntryInfo entry){
+        super(entry);
+    }
+
+    Set<Map.Entry<Object, Object>> entryAttributs;
+    Set<Map.Entry<Object, Object>> manifestMainAttrs;
+}
diff -r d57abf1d1d65 -r 945a4627e256 overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/JarFileAttributeView.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/JarFileAttributeView.java	Wed Jan 28 00:27:48 2009 +0000
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2007-2008 Sun Microsystems, Inc.  All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *   - Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *
+ *   - Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ *   - Neither the name of Sun Microsystems nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package com.sun.nio.zipfs;
+
+import java.io.IOException;
+import java.util.*;
+
+import org.classpath.icedtea.java.nio.file.FileRef;
+
+public class JarFileAttributeView extends ZipFileAttributeView {
+
+    /** Creates a new instance of ZipFileAttributeView */
+    public JarFileAttributeView(FileRef file) {
+        super(file);
+    }
+
+
+    public String name() {
+        return "jar";
+    }
+
+    public Object getAttribute(String attribute) throws IOException {
+        JarFileAttributes jfa = readAttributes();
+        if (attribute.equals("manifestAttributes")) {
+            return jfa.getManifestAttributes();
+        }
+        if (attribute.equals("entryAttributes")) {
+            return jfa.getEntryAttributes();
+        }
+        return super.readAttributes(attribute);
+    }
+
+
+    public JarFileAttributes readAttributes()
+            throws IOException {
+        return new JarFileAttributes(super.getBinding());
+    }
+
+
+    public Map<String, ?> readAttributes(String first, String... rest) throws IOException {
+        Map<String, Object> result = new HashMap<String, Object>();
+        result.putAll(super.readAttributes(first, rest));
+
+        // FIXME - add manifest and entry attributes if requested
+
+        return Collections.unmodifiableMap(result);
+    }
+}
diff -r d57abf1d1d65 -r 945a4627e256 overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/JarFileAttributes.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/JarFileAttributes.java	Wed Jan 28 00:27:48 2009 +0000
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2007-2008 Sun Microsystems, Inc.  All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *   - Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *
+ *   - Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ *   - Neither the name of Sun Microsystems nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package com.sun.nio.zipfs;
+
+import java.util.concurrent.*;
+import java.io.*;
+import java.util.Map;
+import java.util.Set;
+
+import org.classpath.icedtea.java.nio.file.FileRef;
+
+public class JarFileAttributes extends ZipFileAttributes {
+
+    /** Creates a new instance of ZipFileAttributes */
+    public JarFileAttributes(FileRef file)
+            throws IOException {
+        super(file);
+
+    }
+
+    public Set<Map.Entry<Object, Object>> getManifestAttributes() {
+        return ((JarEntryInfo) ze).manifestMainAttrs;
+    }
+
+    public Set<Map.Entry<Object, Object>> getEntryAttributes() {
+        return ((JarEntryInfo) ze).entryAttributs;
+    }
+}
diff -r d57abf1d1d65 -r 945a4627e256 overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/ZipEntryInfo.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/ZipEntryInfo.java	Wed Jan 28 00:27:48 2009 +0000
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2007-2008 Sun Microsystems, Inc.  All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *   - Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *
+ *   - Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ *   - Neither the name of Sun Microsystems nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package com.sun.nio.zipfs;
+
+public class ZipEntryInfo {
+
+    byte[] filename;
+    int compSize;
+    int size;
+    byte[] comment;
+    long crc;
+    byte[] extraField;
+    int method;
+    int extAttrs;
+    long createTime = -1;
+    boolean isDirectory;
+    boolean isOtherFile;
+    boolean isRegularFile;
+    boolean isArchiveFile;
+    long lastAccessTime = -1;
+    long lastModifiedTime;
+    long streamOffset;
+    int versionMadeBy;
+    ZipEntryInfo(ZipEntryInfo entry){
+        this.filename = entry.filename;
+        this.compSize = entry.compSize;
+        this.size = entry.size;
+        this.comment = entry.comment;
+        this.crc = entry.crc;
+        this.extraField = entry.extraField;
+        this.method = entry.method;
+        this.extAttrs = entry.extAttrs;
+        this.createTime = entry.createTime;
+        this.isDirectory = entry.isDirectory;
+        this.isOtherFile = entry.isOtherFile;
+        this.isRegularFile = entry.isRegularFile;
+        this.isArchiveFile = entry.isArchiveFile;
+        this.lastAccessTime = entry.lastAccessTime;
+        this.lastModifiedTime = entry.lastModifiedTime;
+        this.streamOffset = entry.streamOffset;
+        this.versionMadeBy = entry.versionMadeBy;
+
+    }
+    ZipEntryInfo(){
+        super();
+    }
+}
diff -r d57abf1d1d65 -r 945a4627e256 overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/ZipFileAttributeView.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/overlays/nio2/openjdk/jdk/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/ZipFileAttributeView.java	Wed Jan 28 00:27:48 2009 +0000
@@ -0,0 +1,154 @@
+/*
+ * Copyright 2007-2008 Sun Microsystems, Inc.  All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *   - Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *
+ *   - Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ *   - Neither the name of Sun Microsystems nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package com.sun.nio.zipfs;
+
+import java.io.IOException;
+import java.util.*;
+
+import org.classpath.icedtea.java.nio.file.FileRef;
+
+public class ZipFileAttributeView extends ZipFileBasicAttributeView {
+
+    /** Creates a new instance of ZipFileAttributeView */
+    public ZipFileAttributeView(FileRef file) {
+        super(file);
+    }
+
+
+    public String name() {
+        return "zip";
+    }
+
+    public Object getAttribute(String attribute) throws IOException {
+        ZipFileAttributes zfa = readAttributes();
+        if (attribute.equals("comment")) {
+            return zfa.comment();
+        }
+        if (attribute.equals("compressedSize")) {
+            return zfa.compressedSize();
+        }
+        if (attribute.equals("crc")) {
+            return zfa.crc();
+        }
+        if (attribute.equals("extraField")) {
+            return zfa.extra();
+        }
+        if (attribute.equals("method")) {
+            return zfa.method();
+        }
+        if (attribute.equals("fileName")) {
+            return zfa.name();
+        }
+        if (attribute.equals("isArchiveFile")) {
+            return zfa.isArchiveFile();
+        }
+        if (attribute.equals("versionMadeBy")) {
+            return zfa.versionMadeBy();
+        }
+        if (attribute.equals("externalAttrs")) {
+            return zfa.getExternalAttrs();
+        }
+        return super.getAttribute(attribute);
+    }
+
+
+    public Map<String, ?> readAttributes(String first, String... rest) throws IOException {
+        int rem = rest.length;
+        String[] attrs = new String[1 + rem];
+        attrs[0] = first;
+        if (rem > 0)
+            System.arraycopy(rest, 0, attrs, 1, rem);
+        Map<String, Object> result = new HashMap<String, Object>();
+        result.putAll(super.readAttributes(first, rest));
+        ZipFileAttributes zfa = readAttributes();
+        boolean added = false;
+        for (String attr : attrs) {
+            added = addAttribute(result, attr, "comment",zfa.comment());
+            if (added) {
+                continue;
+            }
+            added = addAttribute(result, attr, "compressedSize",zfa.compressedSize());
+            if (added) {
+                continue;
+            }
+            added = addAttribute(result, attr, "crc",zfa.crc());
+            if (added) {
+                continue;
+            }
+            added = addAttribute(result, attr, "extraField",zfa.extra());
+            if (added) {
+                continue;
+            }



More information about the distro-pkg-dev mailing list