Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
JDK 17 jdk.zipfs.jmod - ZIP FS Module
JDK 17 jdk.zipfs.jmod is the JMOD file for JDK 17 ZIP FS module.
JDK 17 ZIP FS module compiled class files are stored in \fyicenter\jdk-17.0.5\jmods\jdk.zipfs.jmod.
JDK 17 ZIP FS module compiled class files are also linked and stored in the \fyicenter\jdk-17.0.5\lib\modules JImage file.
JDK 17 ZIP FS module source code files are stored in \fyicenter\jdk-17.0.5\lib\src.zip\jdk.zipfs.
You can click and view the content of each source code file in the list below.
✍: FYIcenter
⏎ jdk/nio/zipfs/ZipFileSystemProvider.java
/*
* Copyright (c) 2009, 2022, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package jdk.nio.zipfs;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.channels.AsynchronousFileChannel;
import java.nio.channels.FileChannel;
import java.nio.channels.SeekableByteChannel;
import java.nio.file.*;
import java.nio.file.DirectoryStream.Filter;
import java.nio.file.attribute.BasicFileAttributes;
import java.nio.file.attribute.FileAttribute;
import java.nio.file.attribute.FileAttributeView;
import java.nio.file.spi.FileSystemProvider;
import java.security.AccessController;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.zip.ZipException;
import sun.nio.fs.ExtendedFileSystemProvider;
/**
* @author Xueming Shen, Rajendra Gutupalli, Jaya Hangal
*/
public class ZipFileSystemProvider extends FileSystemProvider
implements ExtendedFileSystemProvider {
private final Map<Path, ZipFileSystem> filesystems = new HashMap<>();
public ZipFileSystemProvider() {}
@Override
public boolean exists(Path path) {
return toZipPath(path).exists();
}
@Override
public boolean isRegularFile(Path path) {
return toZipPath(path).isRegularFile();
}
@Override
public boolean isDirectory(Path path) {
return toZipPath(path).isDirectory();
}
@Override
public String getScheme() {
return "jar";
}
protected Path uriToPath(URI uri) {
String scheme = uri.getScheme();
if ((scheme == null) || !scheme.equalsIgnoreCase(getScheme())) {
throw new IllegalArgumentException("URI scheme is not '" + getScheme() + "'");
}
try {
// only support legacy JAR URL syntax jar:{uri}!/{entry} for now
String spec = uri.getRawSchemeSpecificPart();
int sep = spec.indexOf("!/");
if (sep != -1) {
spec = spec.substring(0, sep);
}
return Paths.get(new URI(spec)).toAbsolutePath();
} catch (URISyntaxException e) {
throw new IllegalArgumentException(e.getMessage(), e);
}
}
private boolean ensureFile(Path path) {
try {
BasicFileAttributes attrs =
Files.readAttributes(path, BasicFileAttributes.class);
if (!attrs.isRegularFile())
throw new UnsupportedOperationException();
return true;
} catch (IOException ioe) {
return false;
}
}
@Override
public FileSystem newFileSystem(URI uri, Map<String, ?> env)
throws IOException
{
Path path = uriToPath(uri);
synchronized(filesystems) {
Path realPath = null;
if (ensureFile(path)) {
realPath = path.toRealPath();
if (filesystems.containsKey(realPath))
throw new FileSystemAlreadyExistsException();
}
ZipFileSystem zipfs = getZipFileSystem(path, env);
if (realPath == null) { // newly created
realPath = path.toRealPath();
}
filesystems.put(realPath, zipfs);
return zipfs;
}
}
@Override
public FileSystem newFileSystem(Path path, Map<String, ?> env)
throws IOException
{
ensureFile(path);
return getZipFileSystem(path, env);
}
private ZipFileSystem getZipFileSystem(Path path, Map<String, ?> env) throws IOException {
try {
return new ZipFileSystem(this, path, env);
} catch (ZipException ze) {
String pname = path.toString();
if (pname.endsWith(".zip") || pname.endsWith(".jar"))
throw ze;
throw new UnsupportedOperationException();
}
}
@Override
public Path getPath(URI uri) {
String spec = uri.getSchemeSpecificPart();
int sep = spec.indexOf("!/");
if (sep == -1)
throw new IllegalArgumentException("URI: "
+ uri
+ " does not contain path info ex. jar:file:/c:/foo.zip!/BAR");
return getFileSystem(uri).getPath(spec.substring(sep + 1));
}
@Override
public FileSystem getFileSystem(URI uri) {
synchronized (filesystems) {
ZipFileSystem zipfs = null;
try {
zipfs = filesystems.get(uriToPath(uri).toRealPath());
} catch (IOException x) {
// ignore the ioe from toRealPath(), return FSNFE
}
if (zipfs == null)
throw new FileSystemNotFoundException();
return zipfs;
}
}
// Checks that the given file is a UnixPath
private static ZipPath toZipPath(Path path) {
if (path == null)
throw new NullPointerException();
if (!(path instanceof ZipPath))
throw new ProviderMismatchException();
return (ZipPath)path;
}
@Override
public void checkAccess(Path path, AccessMode... modes) throws IOException {
toZipPath(path).checkAccess(modes);
}
@Override
public void copy(Path src, Path target, CopyOption... options)
throws IOException
{
toZipPath(src).copy(toZipPath(target), options);
}
@Override
public void createDirectory(Path path, FileAttribute<?>... attrs)
throws IOException
{
toZipPath(path).createDirectory(attrs);
}
@Override
public final void delete(Path path) throws IOException {
toZipPath(path).delete();
}
@Override
public <V extends FileAttributeView> V
getFileAttributeView(Path path, Class<V> type, LinkOption... options)
{
return toZipPath(path).getFileAttributeView(type);
}
@Override
public FileStore getFileStore(Path path) throws IOException {
return toZipPath(path).getFileStore();
}
@Override
public boolean isHidden(Path path) {
return toZipPath(path).isHidden();
}
@Override
public boolean isSameFile(Path path, Path other) throws IOException {
return toZipPath(path).isSameFile(other);
}
@Override
public void move(Path src, Path target, CopyOption... options)
throws IOException
{
toZipPath(src).move(toZipPath(target), options);
}
@Override
public AsynchronousFileChannel newAsynchronousFileChannel(Path path,
Set<? extends OpenOption> options,
ExecutorService exec,
FileAttribute<?>... attrs)
{
throw new UnsupportedOperationException();
}
@Override
public SeekableByteChannel newByteChannel(Path path,
Set<? extends OpenOption> options,
FileAttribute<?>... attrs)
throws IOException
{
return toZipPath(path).newByteChannel(options, attrs);
}
@Override
public DirectoryStream<Path> newDirectoryStream(
Path path, Filter<? super Path> filter) throws IOException
{
return toZipPath(path).newDirectoryStream(filter);
}
@Override
public FileChannel newFileChannel(Path path,
Set<? extends OpenOption> options,
FileAttribute<?>... attrs)
throws IOException
{
return toZipPath(path).newFileChannel(options, attrs);
}
@Override
public InputStream newInputStream(Path path, OpenOption... options)
throws IOException
{
return toZipPath(path).newInputStream(options);
}
@Override
public OutputStream newOutputStream(Path path, OpenOption... options)
throws IOException
{
return toZipPath(path).newOutputStream(options);
}
@Override
public <A extends BasicFileAttributes> A
readAttributes(Path path, Class<A> type, LinkOption... options)
throws IOException
{
return toZipPath(path).readAttributes(type);
}
@Override
public Map<String, Object>
readAttributes(Path path, String attributes, LinkOption... options)
throws IOException
{
return toZipPath(path).readAttributes(attributes, options);
}
@Override
public Path readSymbolicLink(Path link) {
throw new UnsupportedOperationException("Not supported.");
}
@Override
public void setAttribute(Path path, String attribute,
Object value, LinkOption... options)
throws IOException
{
toZipPath(path).setAttribute(attribute, value, options);
}
//////////////////////////////////////////////////////////////
@SuppressWarnings("removal")
void removeFileSystem(Path zfpath, ZipFileSystem zfs) throws IOException {
synchronized (filesystems) {
Path tempPath = zfpath;
PrivilegedExceptionAction<Path> action = tempPath::toRealPath;
try {
zfpath = AccessController.doPrivileged(action);
} catch (PrivilegedActionException e) {
throw (IOException) e.getException();
}
if (filesystems.get(zfpath) == zfs)
filesystems.remove(zfpath);
}
}
}
⏎ jdk/nio/zipfs/ZipFileSystemProvider.java
Or download all of them as a single archive file:
File name: jdk.zipfs-17.0.5-src.zip File size: 56454 bytes Release date: 2022-09-13 Download
⇒ FAQ for JDK (Java Development Kit) 17
2022-11-07, ∼6924🔥, 0💬
Popular Posts:
JRE 8 rt.jar is the JAR file for JRE 8 RT (Runtime) libraries. JRE (Java Runtime) 8 is the runtime e...
MP3SPI is a Java Service Provider Interface that adds MP3 (MPEG 1/2/2.5 Layer 1/2/3) audio format su...
What Is XMLBeans xbean.jar 2.6.0? XMLBeans xbean.jar 2.6.0 is the JAR file for Apache XMLBeans 2.6.0...
Where to find answers to frequently asked questions on Downloading and Installing ojdbc.jar - JDBC D...
What Is mail.jar of JavaMail 1.4? I got the JAR file from javamail-1_4.zip. mail.jar in javamail-1_4...