Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/401.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java ZipFileSystem属性_Java_Copy_Filesystems_Zip_File Permissions - Fatal编程技术网

Java ZipFileSystem属性

Java ZipFileSystem属性,java,copy,filesystems,zip,file-permissions,Java,Copy,Filesystems,Zip,File Permissions,因此,我使用的代码非常类似于以下代码(从中提取): 但该文件仍具有“rw-r--r--”权限。。。在设置了“rwxr-xr-x”权限的情况下执行Files.create()操作会得到相同的结果。。。有什么想法吗 编辑:我尝试了以下操作,但只得到一个不支持的操作异常: Set<PosixFilePermission> permissions = PosixFilePermissions.fromString("rwxr-xr-x"); Files.setPosixFilePermiss

因此,我使用的代码非常类似于以下代码(从中提取):

但该文件仍具有“rw-r--r--”权限。。。在设置了“rwxr-xr-x”权限的情况下执行Files.create()操作会得到相同的结果。。。有什么想法吗

编辑:我尝试了以下操作,但只得到一个不支持的操作异常:

Set<PosixFilePermission> permissions = PosixFilePermissions.fromString("rwxr-xr-x");
Files.setPosixFilePermissions(dest, permissions);
Set permissions=PosixFilePermissions.fromString(“rwxr-xr-x”);
setPosixFilePermissions(dest,permissions);
默认情况下,不支持Unix文件系统功能。并且至少不支持存储Unix文件权限

// ZIP created with teh Java zipfs
zipinfo foobar.zip

file system or operating system of origin:      MS-DOS, OS/2 or NT FAT
version of encoding software:                   2.0
...
non-MSDOS external file attributes:             000000 hex
MS-DOS file attributes (00 hex):                none
如果使用Linux版本的Info ZIP实现创建ZIP文件

file system or operating system of origin:      Unix
version of encoding software:                   3.0
...
apparent file type:                             text
Unix file attributes (100755 octal):            -rwxr-xr-x
MS-DOS file attributes (00 hex):                none
有关更多信息,您可以查看
ZipFileSystem.java
的源代码或中包含的当前版本

编辑您可以尝试代替
zipfs
。经过快速检查,它似乎也不支持Unix文件权限

// ZIP created with teh Java zipfs
zipinfo foobar.zip

file system or operating system of origin:      MS-DOS, OS/2 or NT FAT
version of encoding software:                   2.0
...
non-MSDOS external file attributes:             000000 hex
MS-DOS file attributes (00 hex):                none
你可以用。遵循javadoc,它支持Unix权限

// ZIP created with teh Java zipfs
zipinfo foobar.zip

file system or operating system of origin:      MS-DOS, OS/2 or NT FAT
version of encoding software:                   2.0
...
non-MSDOS external file attributes:             000000 hex
MS-DOS file attributes (00 hex):                none

以Info Zip解压可以理解的方式设置Unix权限 指挥部


我理解为什么zip不支持unix特定的标志,但它仍然很烦人。。。。。您知道有哪些库支持unix特定的标志吗?我注意到存储在
ZipFileSystem
中的文件可能会替换现有文件。zfs中文件更新的实现不是非常可伸缩的——它可能会将整个新文件缓存在内存中,直到zfs关闭。