The Class java.io.File

The class java.io.File should really be called “Filename” since most of its methods are concerned with querying and adjusting filename, and pathname information, not the contents of a file. File can't actually do any I/O. Directory, filename and pathname information is often called “metadata,” meaning “data about data.” Methods of java.io.File allow you to access metadata to:

  • Return a File object from a String containing a pathname

  • Test whether a file exists, is readable/writable, or is a directory

  • Say how many bytes are in the file and when it was last modified

  • Delete the file, or create directory paths

  • Get various forms of the file pathname.

Here are all the important public members of java.io.File. Method ...

Get Just Java™ 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.