Stream
专业搬砖工
这个作者很懒,什么都没留下…
展开
-
Demo: zip file system
public class Main { public static void main(String[] args) { String[] data = { "Line 1", "Line 2 2", "Line 3 3 3", "Line 4 4 4 4", "Line 5 5 5 5 5" }; try(FileSystem zipFs = openZip(Paths.get("myData.zip"))) {翻译 2021-07-26 00:12:35 · 138 阅读 · 0 评论 -
Using Default File System and Zip File Systems
Files are contained within a file systemHas a default file systemSpecialized file systems are supportedExample: Zip file systemPath instances are tied to a file systemPaths class works only for default翻译 2021-07-11 20:46:36 · 116 阅读 · 0 评论 -
Accessing Files with the java.nio.file package
java.nio.file preferred packages for filesjava.nio.FileXXX streams are deprecatedProvide a number of benefits over java.ioBetter exception reportingGreater scalabity - large file systemMore file system feature supportSimplifies common task常用clas翻译 2021-07-11 15:11:40 · 287 阅读 · 0 评论 -
File and Buffered Streams
Access FilesOften use streams for file-based I/OClass for each stream type in java.io packageFileReaderFileWriterFileInputStreamFileOutputStreamThe java.io classes are now deprecatedStill widely used in codeBuffered StreamsDirect file ac翻译 2021-07-03 19:51:04 · 82 阅读 · 0 评论 -
Stream Errors and Cleanups
Error handling: Stream methods throw exceptions to indicate errorsClean up:Streams are backed by physical storage, eg. file system, network. cannot rely on standard Java resource recoveryStreams implement Closeable interface, you can call close method翻译 2021-06-27 15:16:45 · 66 阅读 · 0 评论