Uses of Class
java.io.File
Package
Description
Contains all of the classes for creating user interfaces and for painting
graphics and images.
Provides interfaces and classes for interaction with various desktop
capabilities.
Provides for system input and output through data streams,
serialization and the file system.
Provides classes that are fundamental to the design of the Java
programming language.
Defines interfaces and classes for the Java virtual machine to access files,
file attributes, and file systems.
Provides the classes and interfaces for the security framework.
Contains the collections framework, some internationalization support classes,
a service loader, properties, random number generation, string parsing
and scanning classes, base64 encoding and decoding, a bit array, and
several miscellaneous utility classes.
Provides classes for reading and writing the JAR (Java ARchive)
file format, which is based on the standard ZIP file format with an
optional manifest file.
Provides classes for reading and writing the standard ZIP and GZIP file
formats.
The main package of the Java Image I/O API.
A package of the Java Image I/O API containing the plug-in interfaces for
readers, writers, transcoders, and streams, and a runtime registry.
A package of the Java Image I/O API dealing with low-level I/O from files and
streams.
This package contains utility classes related to the Kerberos network
authentication protocol.
Provides interfaces and classes for I/O, sequencing, and synthesis of MIDI
(Musical Instrument Digital Interface) data.
Supplies interfaces for service providers to implement when offering new MIDI
devices, MIDI file readers and writers, or sound bank readers.
Provides interfaces and classes for capture, processing, and playback of
sampled audio data.
Supplies abstract classes for service providers to subclass when offering new
audio devices, sound file readers and writers, or audio format converters.
Provides a set of "lightweight" (all-Java language) components
that, to the maximum degree possible, work the same on all platforms.
Contains classes and interfaces used by the
JFileChooser
component.Provides one interface and many abstract classes that Swing uses to provide
its pluggable look-and-feel capabilities.
Provides user interface objects built according to the Basic look and feel.
Provides user interface objects that combine two or more look and feels.
Provides interfaces for tools which can be invoked from a program,
for example, compilers.
Provides the classes for processing XML documents with a SAX (Simple API for XML)
parser or a DOM (Document Object Model) Document builder.
Provides stream and URI specific transformation classes.
Provides an API for validation of XML documents.
-
Uses of File in java.awt
Modifier and TypeMethodDescriptionFile[]
FileDialog.getFiles()
Returns files that the user selects.Modifier and TypeMethodDescriptionvoid
Desktop.browseFileDirectory
(File file) Opens a folder containing thefile
and selects it in a default system file manager.static Font
Font.createFont
(int fontFormat, File fontFile) Returns a newFont
using the specified font type and the specified font file.static Font[]
Font.createFonts
(File fontFile) Returns a new array ofFont
decoded from the specified file.void
Launches the associated editor application and opens a file for editing.boolean
Desktop.moveToTrash
(File file) Moves the specified file to the trash.void
Launches the associated application to open the file.void
Prints a file with the native desktop printing facility, using the associated application's print command. -
Uses of File in java.awt.desktop
ModifierConstructorDescriptionOpenFilesEvent
(List<File> files, String searchTerm) Constructs anOpenFilesEvent
.PrintFilesEvent
(List<File> files) Constructs aPrintFilesEvent
. -
Uses of File in java.io
Modifier and TypeMethodDescriptionstatic 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.getAbsoluteFile()
Returns the absolute form of this abstract pathname.File.getCanonicalFile()
Returns the canonical form of this abstract pathname.File.getParentFile()
Returns the abstract pathname of this abstract pathname's parent, ornull
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 TypeMethodDescriptionboolean
Tests whether or not the specified abstract pathname should be included in a pathname list.boolean
Tests if a specified file should be included in a file list.int
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
Renames the file denoted by this abstract pathname.ModifierConstructorDescriptionCreates a newFile
instance from a parent abstract pathname and a child pathname string.FileInputStream
(File file) Creates aFileInputStream
by opening a connection to an actual file, the file named by theFile
objectfile
in the file system.FileOutputStream
(File file) Creates a file output stream to write to the file represented by the specifiedFile
object.FileOutputStream
(File file, boolean append) Creates a file output stream to write to the file represented by the specifiedFile
object.FileReader
(File file) FileReader
(File file, Charset charset) FileWriter
(File file) FileWriter
(File file, boolean append) Constructs aFileWriter
given theFile
to write and a boolean indicating whether to append the data written, using the platform's default charset.FileWriter
(File file, Charset charset) FileWriter
(File file, Charset charset, boolean append) Constructs aFileWriter
given theFile
to write, charset and a boolean indicating whether to append the data written.PrintStream
(File file) Creates a new print stream, without automatic line flushing, with the specified file.PrintStream
(File file, String csn) Creates a new print stream, without automatic line flushing, with the specified file and charset.PrintStream
(File file, Charset charset) Creates a new print stream, without automatic line flushing, with the specified file and charset.PrintWriter
(File file) Creates a new PrintWriter, without automatic line flushing, with the specified file.PrintWriter
(File file, String csn) Creates a new PrintWriter, without automatic line flushing, with the specified file and charset.PrintWriter
(File file, Charset charset) Creates a new PrintWriter, without automatic line flushing, with the specified file and charset.RandomAccessFile
(File file, String mode) Creates a random access file stream to read from, and optionally to write to, the file specified by theFile
argument. -
Uses of File in java.lang
Modifier and TypeMethodDescriptionProcessBuilder.directory()
Returns this process builder's working directory.ProcessBuilder.Redirect.file()
Returns theFile
source or destination associated with this redirect, ornull
if there is no such file.Modifier and TypeMethodDescriptionstatic ProcessBuilder.Redirect
Returns a redirect to append to the specified file.Sets this process builder's working directory.Executes the specified command and arguments in a separate process with the specified environment and working directory.Executes the specified string command in a separate process with the specified environment and working directory.static ProcessBuilder.Redirect
Returns a redirect to read from the specified file.ProcessBuilder.redirectError
(File file) Sets this process builder's standard error destination to a file.ProcessBuilder.redirectInput
(File file) Sets this process builder's standard input source to a file.ProcessBuilder.redirectOutput
(File file) Sets this process builder's standard output destination to a file.static ProcessBuilder.Redirect
Returns a redirect to write to the specified file. -
Uses of File in java.nio.file
-
Uses of File in java.security
Modifier and TypeMethodDescriptionstatic final KeyStore
KeyStore.getInstance
(File file, char[] password) Returns a loaded keystore object of the appropriate keystore type.static final KeyStore
KeyStore.getInstance
(File file, KeyStore.LoadStoreParameter param) Returns a loaded keystore object of the appropriate keystore type.static KeyStore.Builder
KeyStore.Builder.newInstance
(File file, KeyStore.ProtectionParameter protection) Returns a new Builder object.static KeyStore.Builder
KeyStore.Builder.newInstance
(String type, Provider provider, File file, KeyStore.ProtectionParameter protection) Returns a new Builder object. -
Uses of File in java.util
ModifierConstructorDescriptionConstructs a new formatter with the specified file.Constructs a new formatter with the specified file and charset.Constructs a new formatter with the specified file, charset, and locale.Constructs a new formatter with the specified file, charset, and locale.Constructs a newScanner
that produces values scanned from the specified file.Constructs a newScanner
that produces values scanned from the specified file.Constructs a newScanner
that produces values scanned from the specified file. -
Uses of File in java.util.jar
ModifierConstructorDescriptionCreates a newJarFile
to read from the specifiedFile
object.Creates a newJarFile
to read from the specifiedFile
object.Creates a newJarFile
to read from the specifiedFile
object in the specified mode.JarFile
(File file, boolean verify, int mode, Runtime.Version version) Creates a newJarFile
to read from the specifiedFile
object in the specified mode. -
Uses of File in java.util.zip
ModifierConstructorDescriptionOpens a ZIP file for reading given the specified File object.Opens a newZipFile
to read from the specifiedFile
object in the specified mode.Opens a newZipFile
to read from the specifiedFile
object in the specified mode.Opens a ZIP file for reading given the specified File object. -
Uses of File in javax.imageio
Modifier and TypeMethodDescriptionstatic File
ImageIO.getCacheDirectory()
Returns the current value set bysetCacheDirectory
, ornull
if no explicit setting has been made.Modifier and TypeMethodDescriptionstatic BufferedImage
Returns aBufferedImage
as the result of decoding a suppliedFile
with anImageReader
chosen automatically from among those currently registered.static void
ImageIO.setCacheDirectory
(File cacheDirectory) Sets the directory where cache files are to be created.static boolean
ImageIO.write
(RenderedImage im, String formatName, File output) Writes an image using an arbitraryImageWriter
that supports the given format to aFile
. -
Uses of File in javax.imageio.spi
Modifier and TypeMethodDescriptionabstract ImageInputStream
ImageInputStreamSpi.createInputStreamInstance
(Object input, boolean useCache, File cacheDir) Returns an instance of theImageInputStream
implementation associated with this service provider.abstract ImageOutputStream
ImageOutputStreamSpi.createOutputStreamInstance
(Object output, boolean useCache, File cacheDir) Returns an instance of theImageOutputStream
implementation associated with this service provider. -
Uses of File in javax.imageio.stream
ModifierConstructorDescriptionFileCacheImageInputStream
(InputStream stream, File cacheDir) Constructs aFileCacheImageInputStream
that will read from a givenInputStream
.FileCacheImageOutputStream
(OutputStream stream, File cacheDir) Constructs aFileCacheImageOutputStream
that will write to a givenoutputStream
.Constructs aFileImageInputStream
that will read from a givenFile
.Constructs aFileImageOutputStream
that will write to a givenFile
. -
Uses of File in javax.security.auth.kerberos
Modifier and TypeMethodDescriptionstatic KeyTab
KeyTab.getInstance
(File file) Returns aKeyTab
instance from aFile
object that is bound to an unknown service principal.static KeyTab
KeyTab.getInstance
(KerberosPrincipal princ, File file) Returns aKeyTab
instance from aFile
object that is bound to the specified service principal.static KeyTab
KeyTab.getUnboundInstance
(File file) Returns an unboundKeyTab
instance from aFile
object. -
Uses of File in javax.sound.midi
Modifier and TypeMethodDescriptionstatic MidiFileFormat
MidiSystem.getMidiFileFormat
(File file) Obtains the MIDI file format of the specifiedFile
.static Sequence
MidiSystem.getSequence
(File file) Obtains a MIDI sequence from the specifiedFile
.static Soundbank
MidiSystem.getSoundbank
(File file) Constructs aSoundbank
by reading it from the specifiedFile
.static int
Writes a stream of bytes representing a file of the MIDI file type indicated to the external file provided. -
Uses of File in javax.sound.midi.spi
Modifier and TypeMethodDescriptionabstract MidiFileFormat
MidiFileReader.getMidiFileFormat
(File file) Obtains the MIDI file format of theFile
provided.abstract Sequence
MidiFileReader.getSequence
(File file) Obtains a MIDI sequence from theFile
provided.abstract Soundbank
SoundbankReader.getSoundbank
(File file) Obtains a soundbank object from theFile
provided.abstract int
Writes a stream of bytes representing a MIDI file of the file type indicated to the external file provided. -
Uses of File in javax.sound.sampled
Modifier and TypeMethodDescriptionstatic AudioFileFormat
AudioSystem.getAudioFileFormat
(File file) Obtains the audio file format of the specifiedFile
.static AudioInputStream
AudioSystem.getAudioInputStream
(File file) Obtains an audio input stream from the providedFile
.static int
AudioSystem.write
(AudioInputStream stream, AudioFileFormat.Type fileType, File out) Writes a stream of bytes representing an audio file of the specified file type to the external file provided. -
Uses of File in javax.sound.sampled.spi
Modifier and TypeMethodDescriptionabstract AudioFileFormat
AudioFileReader.getAudioFileFormat
(File file) Obtains the audio file format of theFile
provided.abstract AudioInputStream
AudioFileReader.getAudioInputStream
(File file) Obtains an audio input stream from theFile
provided.abstract int
AudioFileWriter.write
(AudioInputStream stream, AudioFileFormat.Type fileType, File out) Writes a stream of bytes representing an audio file of the file format indicated to the external file provided. -
Uses of File in javax.swing
Modifier and TypeMethodDescriptionJFileChooser.getCurrentDirectory()
Returns the current directory.JFileChooser.getSelectedFile()
Returns the selected file.File[]
JFileChooser.getSelectedFiles()
Returns a list of selected files if the file chooser is set to allow multiple selection.Modifier and TypeMethodDescriptionboolean
Returns true if the file should be displayed.void
JFileChooser.ensureFileIsVisible
(File f) Makes sure that the specified file is viewable, and not hidden.JFileChooser.getDescription
(File f) Returns the file description.Returns the icon for this file or type of file, depending on the system.Returns the filename.JFileChooser.getTypeDescription
(File f) Returns the file type.boolean
JFileChooser.isTraversable
(File f) Returns true if the file (directory) can be visited.void
JFileChooser.setCurrentDirectory
(File dir) Sets the current directory.void
JFileChooser.setSelectedFile
(File file) Sets the selected file.void
JFileChooser.setSelectedFiles
(File[] selectedFiles) Sets the list of selected files if the file chooser is set to allow multiple selection.ModifierConstructorDescriptionJFileChooser
(File currentDirectory) Constructs aJFileChooser
using the givenFile
as the path.JFileChooser
(File currentDirectory, FileSystemView fsv) Constructs aJFileChooser
using the given current directory andFileSystemView
. -
Uses of File in javax.swing.filechooser
Modifier and TypeMethodDescriptionFileSystemView.createFileObject
(File dir, String filename) Returns a File object constructed in dir from the given filename.FileSystemView.createFileObject
(String path) Returns a File object constructed from the given path string.protected File
FileSystemView.createFileSystemRoot
(File f) Creates a newFile
object forf
with correct behavior for a file system root directory.abstract File
FileSystemView.createNewFolder
(File containingDir) Creates a new folder with a default folder name.File[]
FileSystemView.getChooserComboBoxFiles()
Returns an array of files representing the values which will be shown in the file chooser selector.final File[]
FileSystemView.getChooserShortcutPanelFiles()
Returns an array of files representing the values to show by default in the file chooser shortcuts panel.FileSystemView.getDefaultDirectory()
Return the user's default starting directory for the file chooser.File[]
Gets the list of shown (i.e. not hidden) files.FileSystemView.getHomeDirectory()
Returns the home directory.FileSystemView.getLinkLocation
(File file) Returns the regular file referenced by the specified link file if the specified file is a shell interpreted link.FileSystemView.getParentDirectory
(File dir) Returns the parent directory ofdir
.File[]
FileSystemView.getRoots()
Returns all root partitions on this system.Modifier and TypeMethodDescriptionabstract boolean
Whether the given file is accepted by this filter.boolean
Tests the specified file, returning true if the file is accepted, false otherwise.FileSystemView.createFileObject
(File dir, String filename) Returns a File object constructed in dir from the given filename.protected File
FileSystemView.createFileSystemRoot
(File f) Creates a newFile
object forf
with correct behavior for a file system root directory.abstract File
FileSystemView.createNewFolder
(File containingDir) Creates a new folder with a default folder name.FileView.getDescription
(File f) A human readable description of the file.File[]
Gets the list of shown (i.e. not hidden) files.The icon that represents this file in theJFileChooser
.FileSystemView.getLinkLocation
(File file) Returns the regular file referenced by the specified link file if the specified file is a shell interpreted link.The name of the file.FileSystemView.getParentDirectory
(File dir) Returns the parent directory ofdir
.FileSystemView.getSystemDisplayName
(File f) Name of a file, directory, or folder as it would be displayed in a system file browser.FileSystemView.getSystemIcon
(File f) Icon for a file, directory, or folder as it would be displayed in a system file browser.FileSystemView.getSystemIcon
(File f, int width, int height) Returns an icon for a file, directory, or folder as it would be displayed in a system file browser for the requested size.FileSystemView.getSystemTypeDescription
(File f) Type description for a file, directory, or folder as it would be displayed in a system file browser.FileView.getTypeDescription
(File f) A human readable description of the type of the file.boolean
FileSystemView.isComputerNode
(File dir) Used by UI classes to decide whether to display a special icon for a computer node, e.g.boolean
Used by UI classes to decide whether to display a special icon for drives or partitions, e.g. a "hard disk" icon.boolean
FileSystemView.isFileSystem
(File f) Checks iff
represents a real directory or file as opposed to a special folder such as"Desktop"
.boolean
FileSystemView.isFileSystemRoot
(File dir) Is dir the root of a tree in the file system, such as a drive or partition.boolean
FileSystemView.isFloppyDrive
(File dir) Used by UI classes to decide whether to display a special icon for a floppy disk.boolean
FileSystemView.isHiddenFile
(File f) Returns whether a file is hidden or not.boolean
Returns whether the specified file denotes a shell interpreted link which can be obtained by theFileSystemView.getLinkLocation(File)
.boolean
On Windows, a file can appear in multiple folders, other than its parent directory in the filesystem.boolean
Determines if the given file is a root in the navigable tree(s).FileSystemView.isTraversable
(File f) Returns true if the file (directory) can be visited.FileView.isTraversable
(File f) Whether the directory is traversable or not. -
Uses of File in javax.swing.plaf
Modifier and TypeMethodDescriptionabstract void
FileChooserUI.ensureFileIsVisible
(JFileChooser fc, File f) Ensure the file in question is visible. -
Uses of File in javax.swing.plaf.basic
Modifier and TypeMethodDescriptionprotected File
BasicFileChooserUI.getDirectory()
Property to remember the directory that is currently selected in the UI.Modifier and TypeMethodDescriptionBasicDirectoryModel.getDirectories()
Returns a list of directories.BasicDirectoryModel.getFiles()
Returns a list of files.Modifier and TypeMethodDescriptionboolean
Returns true.void
Caches an icon for a file.void
BasicFileChooserUI.ensureFileIsVisible
(JFileChooser fc, File f) Ensure the file in question is visible.BasicFileChooserUI.BasicFileView.getCachedIcon
(File f) Returns the cached icon for the file.Returns whether or not a file is hidden.protected boolean
Deprecated.Obsolete method, not used anymore.boolean
BasicDirectoryModel.renameFile
(File oldFile, File newFile) Renames a file in the underlying file system.protected void
BasicFileChooserUI.setDirectory
(File f) Property to remember the directory that is currently selected in the UI. -
Uses of File in javax.swing.plaf.multi
Modifier and TypeMethodDescriptionvoid
MultiFileChooserUI.ensureFileIsVisible
(JFileChooser a, File b) Invokes theensureFileIsVisible
method on each UI handled by this object. -
Uses of File in javax.tools
Modifier and TypeMethodDescriptionStandardJavaFileManager.getLocation
(JavaFileManager.Location location) Returns the search path associated with the given location.Modifier and TypeMethodDescriptionIterable<? extends JavaFileObject>
StandardJavaFileManager.getJavaFileObjects
(File... files) Returns file objects representing the given files.Modifier and TypeMethodDescriptionIterable<? extends JavaFileObject>
StandardJavaFileManager.getJavaFileObjectsFromFiles
(Iterable<? extends File> files) Returns file objects representing the given files.void
StandardJavaFileManager.setLocation
(JavaFileManager.Location location, Iterable<? extends File> files) Associates the given search path with the given location. -
Uses of File in javax.xml.parsers
Modifier and TypeMethodDescriptionParse the content of the given file as an XML document and return a new DOMDocument
object.void
SAXParser.parse
(File f, HandlerBase hb) Parse the content of the file specified as XML using the specifiedHandlerBase
.void
SAXParser.parse
(File f, DefaultHandler dh) Parse the content of the file specified as XML using the specifiedDefaultHandler
. -
Uses of File in javax.xml.transform.stream
Modifier and TypeMethodDescriptionvoid
StreamResult.setSystemId
(File f) Set the system ID from aFile
reference.void
StreamSource.setSystemId
(File f) Set the system ID from a File reference.ModifierConstructorDescriptionStreamResult
(File f) Construct a StreamResult from a File.StreamSource
(File f) Construct a StreamSource from a File. -
Uses of File in javax.xml.validation