Java Reference
In-Depth Information
C H A P T E R 8
Interacting with Filesystems
Applications often interact with the filesystem to output data to and/or input data from
files.Java'sstandardclasslibrarysupportsfilesystemaccessviaitsclassic File , Ran-
domAccessFile ,stream,andwriter/readerAPIs. Chapter8 introducesyouto File ,
RandomAccessFile , and various stream and writer/reader APIs.
Note Althoughit'spreferredtoaccessfilesystemsviaJava'sNewI/OAPIs,Idon't
I don't discuss until Chapter 9 . Also, you should know about this chapter's classic I/O
I discuss New I/O in Appendix C.
Applicationsofteninteractwitha filesystem ,whichisusuallyexpressedasahierarchyof
files and directories starting from a root directory .
support at least one filesystem. For example, a Unix or Linux platform combines all
mounted (attachedandprepared)disksintoonevirtualfilesystem.Incontrast,Windows
associates a separate filesystem with each active disk drive.
Java offers access to the platform's available filesystem(s) via its concrete class. File declares the File[] listRoots() class method to
return the root directories (roots) of available filesystems as an array of File objects.
Note Thesetofavailablefilesystemrootsisaffectedbyvariousplatform-leveloper-
physical or virtual disk drives.
Search WWH ::

Custom Search