Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b11f01e

Browse filesBrowse files
authored
Update how-do-i-create-a-java-string-from-the-contents-of-a-file.md
1 parent 465351b commit b11f01e
Copy full SHA for b11f01e

File tree

Expand file treeCollapse file tree

1 file changed

+1
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+1
-1
lines changed

‎contents/how-do-i-create-a-java-string-from-the-contents-of-a-file.md

Copy file name to clipboardExpand all lines: contents/how-do-i-create-a-java-string-from-the-contents-of-a-file.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ List<String> lines = Files.readAllLines(Paths.get(path), encoding);
2626

2727
第二个方法,按行读入,比起一次性全部读入,要消耗更少的内存。因为它每次只将一行的文件信息放在缓存中。然而,如果文本文件很大,这种方法依然会占用很多内存。
2828

29-
如果你的程序需要处理很大的文本文件,在设计的时候就要考虑,分配一块固定的缓存,每次从流中读入文件的一部分放入缓存,处理,然后清空缓存,把下一部分读入缓存,直道处理完所有的数据
29+
如果你的程序需要处理很大的文本文件,在设计的时候就要考虑,分配一块固定的缓存,每次从流中读入文件的一部分放入缓存,处理,然后清空缓存,把下一部分读入缓存,直到处理完所有的数据
3030

3131
这里的“很大”是相对于计算机性能的。一般来说,几十个G的文件应当算是大文件。
3232

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.