O'Reilly logo

Java I/O, NIO and NIO.2 by Jeff Friesen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter    2

File

Applications often interact with a file system, which is usually implemented as a hierarchy of files and directories starting from a root directory. Operating systems on which a Java virtual machine (JVM) runs typically support at least one file system. For example, Unix/Linux combines all mounted (attached and prepared) disks into one virtual file system. In contrast, Windows associates a separate file system with each active disk drive. Java offers access to the underlying operating system’s available file system(s) via its concrete java.io.File class, which this chapter explores.

Constructing File Instances

An instance of the File class contains an abstract representation of a file or directory path (a compact map that locates ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required