| Package | Description |
|---|---|
| java.io |
Provides for system input and output through data streams,
serialization and the file system.
|
| java.nio.file |
Defines interfaces and classes for the Java virtual machine to access files,
file attributes, and file systems.
|
| java.util |
Contains the collections framework, legacy collection classes, event model,
date and time facilities, internationalization, and miscellaneous utility
classes (a string tokenizer, a random-number generator, and a bit array).
|
| Modifier and Type | Method and Description |
|---|---|
static File |
File.createTempFile(String prefix,
String suffix)
Creates an empty file in the default temporary-file directory, using
the given prefix and suffix to generate its name.
|
static File |
File.createTempFile(String prefix,
String suffix,
File directory)
Creates a new empty file in the specified directory, using the
given prefix and suffix strings to generate its name.
|
File |
File.getAbsoluteFile()
Returns the absolute form of this abstract pathname.
|
File |
File.getCanonicalFile()
Returns the canonical form of this abstract pathname.
|
File |
File.getParentFile()
Returns the abstract pathname of this abstract pathname's parent,
or
null if this pathname does not name a parent
directory. |
File[] |
File.listFiles()
Returns an array of abstract pathnames denoting the files in the
directory denoted by this abstract pathname.
|
File[] |
File.listFiles(FileFilter filter)
Returns an array of abstract pathnames denoting the files and
directories in the directory denoted by this abstract pathname that
satisfy the specified filter.
|
File[] |
File.listFiles(FilenameFilter filter)
Returns an array of abstract pathnames denoting the files and
directories in the directory denoted by this abstract pathname that
satisfy the specified filter.
|
static File[] |
File.listRoots()
List the available filesystem roots.
|
| Modifier and Type | Method and Description |
|---|---|
int |
File.compareTo(File pathname)
Compares two abstract pathnames lexicographically.
|
static File |
File.createTempFile(String prefix,
String suffix,
File directory)
Creates a new empty file in the specified directory, using the
given prefix and suffix strings to generate its name.
|
boolean |
File.renameTo(File dest)
Renames the file denoted by this abstract pathname.
|
| Constructor and Description |
|---|
File(File parent,
String child)
Creates a new
File instance from a parent abstract
pathname and a child pathname string. |
| Modifier and Type | Method and Description |
|---|---|
File |
Path.toFile()
Returns a
File object representing this path. |
| Constructor and Description |
|---|
Scanner(File source)
Constructs a new
Scanner that produces values scanned
from the specified file. |
Scanner(File source,
String charsetName)
Constructs a new
Scanner that produces values scanned
from the specified file. |