[英]Create a Java 7 zip FileSystem from an InputStream
Java 7 introduced a zip FileSystem. Java 7引入了一个zip FileSystem。 The link below illustrates how to create a zip FileSystem from a zip file.
以下链接说明了如何从zip文件创建zip文件系统。
http://docs.oracle.com/javase/7/docs/technotes/guides/io/fsp/zipfilesystemprovider.html http://docs.oracle.com/javase/7/docs/technotes/guides/io/fsp/zipfilesystemprovider.html
However, I can find no example of how to create a zip FileSystem from an InputStream. 但是,我找不到如何从InputStream创建zip FileSystem的示例。 Is that possible?
那可能吗? If so, how?
如果是这样,怎么办?
Note: I know I can write the InputStream to disk and create a zip FileSystem as described. 注意:我知道我可以将InputStream写入磁盘并按说明创建一个zip FileSystem。 I consider that a hack, and I would prefer to avoid it.
我认为这是一种骇客,我希望避免这种情况。
Only a partial answer, but I expect you'll need a custom file system provider and this question about an in-memory file system might help . 只有部分答案,但是我希望您需要一个自定义文件系统提供程序 , 有关内存中文件系统的这个问题可能会有所帮助 。 Note that the newFileSystem documentation shows a
memory://...
URL scheme, but no more detail. 请注意, newFileSystem文档显示了一个
memory://...
URL方案,但没有更多细节。
As pointed out in another answer, the file system requires bidirectional access to the data, so this assumes enough memory to load it entirely. 正如另一个答案中指出的那样,文件系统要求对数据进行双向访问,因此这假定有足够的内存来完全加载它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.