APIdia Launch Partner
Top Description Inners Fields Constructors Methods
jdk.nio.zipfs

pack-priv Class ZipFileSystem

extends FileSystem
Class Inheritance
Imports
java.io.BufferedOutputStream, .ByteArrayInputStream, .ByteArrayOutputStream, .EOFException, .FilterOutputStream, .IOException, .InputStream, .OutputStream, java.lang.Runtime.Version, java.nio.ByteBuffer, .MappedByteBuffer, java.nio.channels.FileChannel, .FileLock, .ReadableByteChannel, .SeekableByteChannel, .WritableByteChannel, java.nio.file.*, java.nio.file.attribute.*, java.nio.file.spi.FileSystemProvider, java.util.*, java.util.concurrent.locks.ReadWriteLock, .ReentrantReadWriteLock, java.util.function.Consumer, .Function, java.util.jar.Attributes, .Manifest, java.util.regex.Pattern, java.util.zip.CRC32, .Deflater, .DeflaterOutputStream, .Inflater, .InflaterInputStream, .ZipException

A FileSystem built on a zip file
Author
Xueming Shen

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
pack-priv static class
pack-priv static class
private class
private class
private class
private class
private class
private class
pack-priv static class
pack-priv static class
pack-priv class
private static enum

Field Summary

Modifier and TypeField and Description
pack-priv final byte[]
private final SeekableByteChannel
private static final String
private static final String
private final int
private final GroupPrincipal
private final UserPrincipal
private final Set<PosixFilePermission>
private final List<Deflater>
private ZipFileSystem.END
private Function<byte[], byte[]>
private final boolean
private static final String
private boolean
private final List<Inflater>
private LinkedHashMap<ZipFileSystem.IndexNode, ZipFileSystem.IndexNode>
private volatile boolean
private static final boolean
private long
private final ZipFileSystem.IndexNode
private static final int
private final int
private final boolean
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private final ZipFileSystemProvider
private boolean
private static final String
private final ZipPath
private static final byte[]
private final ReadWriteLock
private Set<InputStream>
private final Set<String>
pack-priv final boolean
private final int
private final Set<Path>
private final boolean
pack-priv final ZipCoder
private final Path
private final long

Constructor Summary

AccessConstructor and Description
pack-priv
ZipFileSystem(ZipFileSystemProvider provider, Path zfpath, Map<String, ?> env)

Method Summary

Modifier and TypeMethod and Description
private void
private void
private void
pack-priv void
checkAccess(byte[] path)

private final void
checkEncoding(byte[] a)

private void
checkExtraFields(byte[]
CEN array
cen
,
int
starting offset in the CEN for the Extra field
cenPos
,
long
CEN size value
size
,
long
CEN csize value
csize
,
long
CEN LOC offset value
locoff
,
int
CEN Disk number value
diskNo
,
int
Extra Field starting offset within the CEN
startingOffset
,
int
Length of this Extra field
extraFieldLen
)

Validate the Zip64 Extra block fields

private void
checkOptions(Set<? extends OpenOption> options)

private void
checkParents(byte[] path)

private final void
checkUTF8(byte[] a)

private void
private void
checkZip64ExtraFieldValues(byte[]
CEN array
cen
,
int
the starting offset for the Zip64 field value
off
,
int
the size of the Zip64 Extended Extra Field
blockSize
,
long
CEN header compressed size value
csize
,
long
CEN header uncompressed size value
size
,
long
CEN header LOC offset
locoff
,
int
CEN header Disk Number
diskNo
)

Validate the Zip64 Extended Information Extra Field (0x0001) block size; that the uncompressed size, compressed size field and LOC offset fields are not negative.

public void
close()

Implements abstract java.nio.file.FileSystem.close.

Implements java.io.Closeable.close.

Closes this file system.

pack-priv void
copyFile(boolean deletesrc, byte[] src, byte[] dst, CopyOption... options)

private long
copyLOCEntry(ZipFileSystem.Entry e, boolean updateHeader, OutputStream os, long written, byte[] buf)

pack-priv void
createDirectory(byte[] dir, FileAttribute<?>... attrs)

private Path
public void
deleteFile(byte[] path, boolean failIfNotExists)

private Optional<Integer>
determineReleaseVersion(Map<String, ?> env)

If a version property has been specified and the file represents a multi-release JAR, determine the requested runtime version and initialize the ZipFileSystem instance accordingly.

private void
private void
private void
pack-priv boolean
exists(byte[] path)

protected void
finalize()

Overrides java.lang.Object.finalize.

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

private ZipFileSystem.END
pack-priv final byte[]
private int

Returns:

The Compression method to use
getDefaultCompressionMethod
(Map<String, ?>
Zip FS map of properties
env
)

Return the compression method to use (STORED or DEFLATED).

private Deflater
private ZipFileSystem.Entry
getEntry(byte[] path)

pack-priv ZipFileAttributes
getFileAttributes(byte[] path)

pack-priv FileStore
public Iterable<FileStore>
getFileStores()

Implements abstract java.nio.file.FileSystem.getFileStores.

Returns an object to iterate over the underlying file stores.

private Inflater
private ZipFileSystem.IndexNode
getInode(byte[] path)

private InputStream
private ZipFileSystem.IndexNode
getOrCreateInode(byte[] path, boolean isdir)

Return the IndexNode from the root tree.

private OutputStream
private static byte[]
getParent(byte[] path)

private static int
getParentOff(byte[] path)

public ZipPath
getPath(String first, String... more)

Implements abstract java.nio.file.FileSystem.getPath.

Converts a path string, or a sequence of strings that when joined form a path string, to a Path.

public PathMatcher
getPathMatcher(String syntaxAndInput)

Implements abstract java.nio.file.FileSystem.getPathMatcher.

Returns a PathMatcher that performs match operations on the String representation of Path objects by interpreting a given pattern.

private PosixFileAttributes

Returns:

The POSIX file attributes for the specified file or null if the POSIX attribute view is not available
getPosixAttributes
(Path
The path to the file
path
)

Returns a file's POSIX file attributes.

pack-priv ZipPath
public Iterable<Path>
getRootDirectories()

Implements abstract java.nio.file.FileSystem.getRootDirectories.

Returns an object to iterate over the paths of the root directories.

private byte[]
getRootName(ZipFileSystem.IndexNode inode, ZipFileSystem.IndexNode prefix)

Extract the root name from a versioned entry name.

public String
getSeparator()

Implements abstract java.nio.file.FileSystem.getSeparator.

Returns the name separator, represented as a string.

pack-priv final String
getString(byte[] name)

private Path
getTempPathForEntry(byte[] path)

public UserPrincipalLookupService
getUserPrincipalLookupService()

Implements abstract java.nio.file.FileSystem.getUserPrincipalLookupService.

Returns the UserPrincipalLookupService for this file system (optional operation).

private Integer
getVersion(ZipFileSystem.IndexNode inode, ZipFileSystem.IndexNode metaInfVersions)

Extract the integer version number -- META-INF/versions/9 returns 9.

private TreeMap<Integer, ZipFileSystem.IndexNode>
getVersionMap(int version, ZipFileSystem.IndexNode metaInfVersions)

Create a sorted version map of version -> inode, for inodes <= max version.

pack-priv Path
private byte[]
private GroupPrincipal
initGroup(Path zfpath, Map<String, ?> env)

private UserPrincipal
initOwner(Path zfpath, Map<String, ?> env)

private Set<PosixFilePermission>
pack-priv boolean
isDirectory(byte[] path)

private boolean
isMultiReleaseJar()

Returns true if the Manifest main attribute "Multi-Release" is set to true; false otherwise.

public boolean
isOpen()

Implements abstract java.nio.file.FileSystem.isOpen.

Tells whether or not this file system is open.

public boolean
isReadOnly()

Implements abstract java.nio.file.FileSystem.isReadOnly.

Tells whether or not this file system allows only read-only access to its file stores.

private static boolean
isTrue(Map<String, ?> env, String name)

private static boolean

Returns:

true if the extra block size is valid; false otherwise
isZip64ExtBlockSizeValid
(int
the Zip64 Extended Information Extra Field size
blockSize
,
long
CEN header compressed size value
csize
,
long
CEN header uncompressed size value
size
,
long
CEN header LOC offset
locoff
,
int
CEN header Disk Number
diskNo
)

Validate the size and contents of a Zip64 extended information field The order of the Zip64 fields is fixed, but the fields MUST only appear if the corresponding LOC or CEN field is set to 0xFFFF: or 0xFFFFFFFF: Uncompressed Size - 8 bytes Compressed Size - 8 bytes LOC Header offset - 8 bytes Disk Start Number - 4 bytes See PKWare APP.Note Section 4.5.3 for more details

pack-priv Iterator<Path>
pack-priv byte[]
lookupPath(byte[] resolvedPath)

Package-private accessor to entry alias map used by ZipPath.

private void
pack-priv SeekableByteChannel
newByteChannel(byte[] path, Set<? extends OpenOption> options, FileAttribute<?>... attrs)

pack-priv FileChannel
newFileChannel(byte[] path, Set<? extends OpenOption> options, FileAttribute<?>... attrs)

pack-priv InputStream
newInputStream(byte[] path)

pack-priv OutputStream
newOutputStream(byte[] path, OpenOption... options)

public WatchService
newWatchService()

Implements abstract java.nio.file.FileSystem.newWatchService.

Constructs a new WatchService (optional operation).

public FileSystemProvider
provider()

Implements abstract java.nio.file.FileSystem.provider.

Returns the provider that created this file system.

private int
readAt(ByteBuffer bb, long pos)

pack-priv final long
readNBytesAt(byte[] buf, int off, long len, long pos)

Reads len bytes of data at the given file position into the given byte array starting at the given array offset.

private void
private void
private void
private void
pack-priv void
setGroup(byte[] path, GroupPrincipal group)

pack-priv void
setOwner(byte[] path, UserPrincipal owner)

pack-priv void
setPermissions(byte[] path, Set<PosixFilePermission> perms)

pack-priv void
setTimes(byte[] path, FileTime mtime, FileTime atime, FileTime ctime)

public Set<String>
supportedFileAttributeViews()

Implements abstract java.nio.file.FileSystem.supportedFileAttributeViews.

Returns the set of the names of the file attribute views supported by this FileSystem.

private void
sync()

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

private void
private void
private void
walk(ZipFileSystem.IndexNode inode, Consumer<ZipFileSystem.IndexNode> consumer)

Walk the IndexNode tree processing all leaf nodes.

private long
private void
private static void