Class FileSystemsNewFileSystemExamples
java.lang.Object
net.jrodolfo.java_evolution.java13.FileSystemsNewFileSystemExamples
Demonstrates the
FileSystems.newFileSystem(Path) convenience overload
added in Java 13.
Before Java 13, opening an archive or other provider-backed path as a file system required more verbose overloads. That added ceremony to the common case where the path itself contained enough information.
The Java 13 overload solves that convenience problem by letting code open a
supported file system directly from a Path.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionreadTextFromArchive(Path archivePath, String fileName) Opens a file system from a path, reads one file, and closes the file system.
-
Constructor Details
-
FileSystemsNewFileSystemExamples
public FileSystemsNewFileSystemExamples()
-
-
Method Details
-
readTextFromArchive
Opens a file system from a path, reads one file, and closes the file system.- Parameters:
archivePath- path to an archive supported by an installed file system providerfileName- the file inside the archive to read- Returns:
- the file content
- Throws:
IOException- when the archive cannot be opened or read
-