Package net.fabricmc.loom.util
Class FileSystemUtil
java.lang.Object
net.fabricmc.loom.util.FileSystemUtil
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classstatic class -
Method Summary
Modifier and TypeMethodDescriptionstatic FileSystemUtil.DelegategetJarFileSystem(File file, boolean create) static FileSystemUtil.DelegategetJarFileSystem(URI uri, boolean create) static FileSystemUtil.DelegategetJarFileSystem(Path path) static FileSystemUtil.DelegategetJarFileSystem(Path path, boolean create) static FileSystemUtil.DelegategetReadOnlyJarFileSystem(Path path) 打开只读 jar 文件系统,走 JDK 的newFileSystem(Path, Map)重载.
-
Method Details
-
getReadOnlyJarFileSystem
打开只读 jar 文件系统,走 JDK 的newFileSystem(Path, Map)重载.与
getJarFileSystem(Path, boolean)的差别:该重载返回独立的文件系统实例, 不进入 JDK 进程级的ZipFileSystemProvider.filesystems登记簿,因此既不产生FileSystemAlreadyExistsException,也不与 tiny-remapper 的全局锁FileSystemReference.openFsMap发生交互。多个线程可同时打开同一 jar.调用方须保证只读取、不写入:独立实例各自持有文件锁,对同一 jar 并发写入会失败 (
AccessDeniedException)。需要写入时请用getJarFileSystem(Path, boolean), 它经由 tiny-remapper 引用计数共享同一文件系统.文件不存在时抛
NoSuchFileException,与原有实现一致.- Throws:
IOException
-
getJarFileSystem
public static FileSystemUtil.Delegate getJarFileSystem(File file, boolean create) throws IOException - Throws:
IOException
-
getJarFileSystem
public static FileSystemUtil.Delegate getJarFileSystem(Path path, boolean create) throws IOException - Throws:
IOException
-
getJarFileSystem
- Throws:
IOException
-
getJarFileSystem
- Throws:
IOException
-