加载多个文本文件. [英] Load multiple text files.

查看:83
本文介绍了加载多个文本文件.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好.
有谁知道我是否可以同时加载多个文本文件,然后分别处理每个文本文件.
我只想获取每个文本文档的内容并将其存储在class的对象中,但是我不知道如何独立对待ech文本文档:S

谁能帮忙!!!!!
thx:)

Hi All.
Does anyone have an idea if i can load multiple text files in the same time and then treat each text file independently.
i just want to take the content of each text document and store it in object of class ,, but i don''t know how to treat ech text document independtly :S

can anyone help!!!!!
thx :)

推荐答案

独立处理每个文本文档"是什么意思?将它们全部加载到同一列表中.如果要同时加载它们,请在其自己的线程中开始每次加载到列表中.为防止线程冲突,请确保在访问列表时正确锁定.如果所有文件都位于同一硬盘驱动器上,则同时读取所有文件可能会减慢速度(例如,顺序加载而不是异步加载所有文件会更快.)
What do you mean "treat each text document independently"? Load them all into the same list. If you want to load them at the same time, start each loading into the list in its own thread. To prevent your threading conflicts, make sure you lock properly when accessing the list. If all the files are on the same hard drive, reading them all at the same time will probably slow things down (i.e., it would be faster to load them all sequentially rather than asynchronously).


您也许应该阅读有关OO的基础书籍.如果您创建一个代表文档的类,并为每个文档创建一个实例,则可以立即解决您的问题.实际上,解决该问题的唯一方法是编写专门设计用于不同工作方式的代码.
You should perhaps read a basic book on OO. If you create a class to represent a document, and create an instance for each document, your problem is instantly solved. In fact, the only way to unsolve it, would be to write code specifically designed to work differently.


这篇关于加载多个文本文件.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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