解析整个Windows文件夹&它的内容为Stream [英] Parse an entire Windows folder & its contents as a Stream

查看:74
本文介绍了解析整个Windows文件夹&它的内容为Stream的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将文件夹及其内容(文件和子文件夹)转换为单个流,该流将返回到某个应用程序。问题是我无法压缩文件夹。现在,我想知道是否有办法修改文件夹的属性或类型,以便将其视为单个但未知的文件。所以我可以使用一个FILESTREAM对象来读它。



我能想到的另一种方法是返回一个包含所有流的流的数组根文件夹和子文件夹中的文件。连同文本/ xml文件也在流中,它将存储每个文件在Stream数组中的位置。

I am trying to convert a folder & it's contents (files & sub-folders) to a single stream which will be returned to some application. The problem is that I cannot compress the folder. Now, I want to know that whether there's a way to modify the attributes or type of a folder so that it will be treated as a single but unknown file. So that I can read it using a single FILESTREAM object.

Another way that I could think of is to return an array of stream which will contain the stream of all the files inside the root folders & sub-folders. Along with that a text/xml file also in stream, which will store the location of each file inside the Stream array.

推荐答案

最好的方法是创建一些将所有数据作为流返回的类。在类中,您将遍历所有文件并从磁盘读取其数据,并将其传递回调用方。唯一的问题是如何识别一个文件的结尾和另一个文件的开头。
The best way would be to create some class that would return all the data as a stream. Inside the class you would iterate through all the files and read their data from disk, passing it back to the caller. The only issue would be how you identify the end of one file and the beginning of another.


这篇关于解析整个Windows文件夹&它的内容为Stream的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆