站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JDK 5 Documentation v1.4.1, Java 2 SDK 英文文档

Uses of Class java.io.File (Java 2 Platform SE v1.4.1) - JDK 5 Documentation v1.4.1, Java 2 SDK 英文文档

JavaTM 2 Platform
Std. Ed. v1.4.1

Uses of Class
java.io.File

Packages that use File
java.io Provides for system input and output through data streams, serialization and the file system. 
java.lang Provides classes that are fundamental to the design of the Java programming language. 
java.util.jar 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. 
java.util.zip Provides classes for reading and writing the standard ZIP and GZIP file formats. 
javax.imageio The main package of the Java Image I/O API. 
javax.imageio.spi A package of the Java Image I/O API containing the plug-in interfaces for readers, writers, transcoders, and streams, and a runtime registry. 
javax.imageio.stream A package of the Java Image I/O API dealing with low-level I/O from files and streams. 
javax.sound.midi Provides interfaces and classes for I/O, sequencing, and synthesis of MIDI (Musical Instrument Digital Interface) data. 
javax.sound.midi.spi Supplies interfaces for service providers to implement when offering new MIDI devices, MIDI file readers and writers, or sound bank readers. 
javax.sound.sampled Provides interfaces and classes for capture, processing, and playback of sampled audio data. 
javax.sound.sampled.spi Supplies abstract classes for service providers to subclass when offering new audio devices, sound file readers and writers, or audio format converters. 
javax.swing Provides a set of "lightweight" (all-Java language) components that, to the maximum degree possible, work the same on all platforms. 
javax.swing.filechooser Contains classes and interfaces used by the JFileChooser component. 
javax.swing.plaf Provides one interface and many abstract classes that Swing uses to provide its pluggable look-and-feel capabilities. 
javax.swing.plaf.basic Provides user interface objects built according to the Basic look and feel. 
javax.swing.plaf.metal Provides user interface objects built according to the Java look and feel (once codenamed Metal), which is the default look and feel. 
javax.swing.plaf.multi Provides user interface objects that combine two or more look and feels. 
javax.xml.parsers Provides classes allowing the processing of XML documents. 
javax.xml.transform.stream This package implements stream- and URI- specific transformation APIs. 
 

Uses of File in java.io
 

Methods in java.io that return File
 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.getAbsoluteFile()
          Returns the absolute form of this abstract pathname.
 File File.getCanonicalFile()
          Returns the canonical form of this abstract pathname.
 File[] File.listFiles()
          Returns an array of abstract pathnames denoting the files in the directory denoted by this abstract pathname.
 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.
 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.
static File[] File.listRoots()
          List the available filesystem roots.
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.
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.
 

Methods in java.io with parameters of type File
 boolean FileFilter.accept(File pathname)
          Tests whether or not the specified abstract pathname should be included in a pathname list.
 boolean FilenameFilter.accept(File dir, String name)
          Tests if a specified file should be included in a file list.
 boolean File.renameTo(File dest)
          Renames the file denoted by this abstract pathname.
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.
 int File.compareTo(File pathname)
          Compares two abstract pathnames lexicographically.
 

Constructors in java.io with parameters of type File
FileWriter(File file)
          Constructs a FileWriter object given a File object.
FileWriter(File file, boolean append)
          Constructs a FileWriter object given a File object.
FileReader(File file)
          Creates a new FileReader, given the File to read from.
RandomAccessFile(File file, String mode)
          Creates a random access file stream to read from, and optionally to write to, the file specified by the File argument.
FileOutputStream(File file)
          Creates a file output stream to write to the file represented by the specified File object.
FileOutputStream(File file, boolean append)
          Creates a file output stream to write to the file represented by the specified File object.
FileInputStream(File file)
          Creates a FileInputStream by opening a connection to an actual file, the file named by the File object file in the file system.
File(File parent, String child)
          Creates a new File instance from a parent abstract pathname and a child pathname string.
 

Uses of File in java.lang
 

Methods in java.lang with parameters of type File
 Process Runtime.exec(String command, String[] envp, File dir)
          Executes the specified string command in a separate process with the specified environment and working directory.
 Process Runtime.exec(String[] cmdarray, String[] envp, File dir)
          Executes the specified command and arguments in a separate process with the specified environment and working directory.
 

Uses of File in java.util.jar
 

Constructors in java.util.jar with parameters of type File
JarFile(File file)
          Creates a new JarFile to read from the specified File object.
JarFile(File file, boolean verify)
          Creates a new JarFile to read from the specified File object.
JarFile(File file, boolean verify, int mode)
          Creates a new JarFile to read from the specified File object in the specified mode.
 

Uses of File in java.util.zip
 

Constructors in java.util.zip with parameters of type File
ZipFile(File file, int mode)
          Opens a new ZipFile to read from the specified File object in the specified mode.
ZipFile(File file)
          Opens a ZIP file for reading given the specified File object.
 

Uses of File in javax.imageio
 

Methods in javax.imageio that return File
static File ImageIO.getCacheDirectory()
          Returns the current value set by setCacheDirectory, or null if no explicit setting has been made.
 

Methods in javax.imageio with parameters of type File
static void ImageIO.setCacheDirectory(File cacheDirectory)
          Sets the directory where cache files are to be created.
static BufferedImage ImageIO.read(File input)
          Returns a BufferedImage as the result of decoding a supplied File with an ImageReader chosen automatically from among those currently registered.
static boolean ImageIO.write(RenderedImage im, String formatName, File output)
          Writes an image using an arbitrary ImageWriter that supports the given format to a File.
 

Uses of File in javax.imageio.spi
 

Methods in javax.imageio.spi with parameters of type File
abstract  ImageOutputStream ImageOutputStreamSpi.createOutputStreamInstance(Object output, boolean useCache, File cacheDir)
          Returns an instance of the ImageOutputStream implementation associated with this service provider.
abstract  ImageInputStream ImageInputStreamSpi.createInputStreamInstance(Object input, boolean useCache, File cacheDir)
          Returns an instance of the ImageInputStream implementation associated with this service provider.
 

Uses of File in javax.imageio.stream
 

Constructors in javax.imageio.stream with parameters of type File
FileCacheImageOutputStream(OutputStream stream, File cacheDir)
          Constructs a FileCacheImageOutputStream that will write to a given outputStream.
FileCacheImageInputStream(InputStream stream, File cacheDir)
          Constructs a FileCacheImageInputStream that will read from a given InputStream.
FileImageOutputStream(File f)
          Constructs a FileImageOutputStream that will write to a given File.
FileImageInputStream(File f)
          Constructs a FileImageInputStream that will read from a given File.
 

Uses of File in javax.sound.midi
 

Methods in javax.sound.midi with parameters of type File
static Soundbank MidiSystem.getSoundbank(File file)
          Constructs a Soundbank by reading it from the specified File.
static MidiFileFormat MidiSystem.getMidiFileFormat(File file)
          Obtains the MIDI file format of the specified File.
static Sequence MidiSystem.getSequence(File file)
          Obtains a MIDI sequence from the specified File.
static int MidiSystem.write(Sequence in, int type, File out)
          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
 

Methods in javax.sound.midi.spi with parameters of type File
abstract  Soundbank SoundbankReader.getSoundbank(File file)
          Obtains a soundbank object from the File provided.
abstract  MidiFileFormat MidiFileReader.getMidiFileFormat(File file)
          Obtains the MIDI file format of the File provided.
abstract  Sequence MidiFileReader.getSequence(File file)
          Obtains a MIDI sequence from the File provided.
abstract  int MidiFileWriter.write(Sequence in, int fileType, File out)
          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
 

Methods in javax.sound.sampled with parameters of type File
static AudioFileFormat AudioSystem.getAudioFileFormat(File file)
          Obtains the audio file format of the specified File.
static AudioInputStream AudioSystem.getAudioInputStream(File file)
          Obtains an audio input stream from the provided File.
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
 

Methods in javax.sound.sampled.spi with parameters of type File
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.
abstract  AudioFileFormat AudioFileReader.getAudioFileFormat(File file)
          Obtains the audio file format of the File provided.
abstract  AudioInputStream AudioFileReader.getAudioInputStream(File file)
          Obtains an audio input stream from the File provided.
 

Uses of File in javax.swing
 

Methods in javax.swing that return File
 File 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.
 File JFileChooser.getCurrentDirectory()
          Returns the current directory.
 

Methods in javax.swing with parameters of type File
 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.
 void JFileChooser.setCurrentDirectory(File dir)
          Sets the current directory.
 void JFileChooser.ensureFileIsVisible(File f)
          Makes sure that the specified file is viewable, and not hidden.
 String JFileChooser.getName(File f)
          Returns the filename.
 String JFileChooser.getDescription(File f)
          Returns the file description.
 String JFileChooser.getTypeDescription(File f)
          Returns the file type.
 Icon JFileChooser.getIcon(File f)
          Returns the icon for this file or type of file, depending on the system.
 boolean JFileChooser.isTraversable(File f)
          Returns true if the file (directory) can be visited.
 boolean JFileChooser.accept(File f)
          Returns true if the file should be displayed.
 

Constructors in javax.swing with parameters of type File
JFileChooser(File currentDirectory)
          Constructs a JFileChooser using the given File as the path.
JFileChooser(File currentDirectory, FileSystemView fsv)
          Constructs a JFileChooser using the given current directory and FileSystemView.
 

Uses of File in javax.swing.filechooser
 

Methods in javax.swing.filechooser that return File
 File FileSystemView.getChild(File parent, String fileName)
           
abstract  File FileSystemView.createNewFolder(File containingDir)
          Creates a new folder with a default folder name.
 File[] FileSystemView.getRoots()
          Returns all root partitions on this system.
 File FileSystemView.getHomeDirectory()
           
 File FileSystemView.getDefaultDirectory()
          Return the user's default starting directory for the file chooser.
 File FileSystemView.createFileObject(File dir, String filename)
          Returns a File object constructed in dir from the given filename.
 File FileSystemView.createFileObject(String path)
          Returns a File object constructed from the given path string.
 File[] FileSystemView.getFiles(File dir, boolean useFileHiding)
          Gets the list of shown (i.e.
 File FileSystemView.getParentDirectory(File dir)
          Returns the parent directory of dir.
protected  File FileSystemView.createFileSystemRoot(File f)
          Creates a new File object for f with correct behavior for a file system root directory.
 

Methods in javax.swing.filechooser with parameters of type File
 boolean FileSystemView.isRoot(File f)
          Determines if the given file is a root in the navigatable tree(s).
 Boolean FileSystemView.isTraversable(File f)
          Returns true if the file (directory) can be visited.
 String FileSystemView.getSystemDisplayName(File f)
          Name of a file, directory, or folder as it would be displayed in a system file browser.
 String FileSystemView.getSystemTypeDescription(File f)
          Type description for a file, directory, or folder as it would be displayed in a system file browser.
 Icon FileSystemView.getSystemIcon(File f)
          Icon for a file, directory, or folder as it would be displayed in a system file browser.
 boolean FileSystemView.isParent(File folder, File file)
          On Windows, a file can appear in multiple folders, other than its parent directory in the filesystem.
 boolean FileSystemView.isParent(File folder, File file)
          On Windows, a file can appear in multiple folders, other than its parent directory in the filesystem.
 File FileSystemView.getChild(File parent, String fileName)
           
 boolean FileSystemView.isFileSystem(File f)
           
abstract  File FileSystemView.createNewFolder(File containingDir)
          Creates a new folder with a default folder name.
 boolean FileSystemView.isHiddenFile(File f)
          Returns whether a file is hidden or not.
 boolean FileSystemView.isFileSystemRoot(File dir)
           
 boolean FileSystemView.isDrive(File dir)
           
 boolean FileSystemView.isFloppyDrive(File dir)
           
 boolean FileSystemView.isComputerNode(File dir)
           
 File FileSystemView.createFileObject(File dir, String filename)
          Returns a File object constructed in dir from the given filename.
 File[] FileSystemView.getFiles(File dir, boolean useFileHiding)
          Gets the list of shown (i.e.
 File FileSystemView.getParentDirectory(File dir)
          Returns the parent directory of dir.
protected  File FileSystemView.createFileSystemRoot(File f)
          Creates a new File object for f with correct behavior for a file system root directory.
abstract  boolean FileFilter.accept(File f)
          Whether the given file is accepted by this filter.
 String FileView.getName(File f)
          The name of the file.
 String FileView.getDescription(File f)
          A human readable description of the file.
 String FileView.getTypeDescription(File f)
          A human readable description of the type of the file.
 Icon FileView.getIcon(File f)
          The icon that represents this file in the JFileChooser.
 Boolean FileView.isTraversable(File f)
          Whether the directory is traversable or not.
 

Uses of File in javax.swing.plaf
 

Methods in javax.swing.plaf with parameters of type File
abstract  void FileChooserUI.ensureFileIsVisible(JFileChooser fc, File f)
           
 

Uses of File in javax.swing.plaf.basic
 

Methods in javax.swing.plaf.basic that return File
protected  File BasicFileChooserUI.getDirectory()
          Property to remember the directory that is currently selected in the UI.
 

Methods in javax.swing.plaf.basic with parameters of type File
 String BasicFileChooserUI.BasicFileView.getName(File f)
           
 String BasicFileChooserUI.BasicFileView.getDescription(File f)
           
 String BasicFileChooserUI.BasicFileView.getTypeDescription(File f)
           
 Icon BasicFileChooserUI.BasicFileView.getCachedIcon(File f)
           
 void BasicFileChooserUI.BasicFileView.cacheIcon(File f, Icon i)
           
 Icon BasicFileChooserUI.BasicFileView.getIcon(File f)
           
 Boolean BasicFileChooserUI.BasicFileView.isHidden(File f)
           
 boolean BasicFileChooserUI.AcceptAllFileFilter.accept(File f)
           
 void BasicFileChooserUI.ensureFileIsVisible(JFileChooser fc, File f)
           
protected  void BasicFileChooserUI.setDirectory(File f)
          Property to remember the directory that is currently selected in the UI.
 boolean BasicDirectoryModel.renameFile(File oldFile, File newFile)
          Renames a file in the underlying file system.
 boolean BasicDirectoryModel.renameFile(File oldFile, File newFile)
          Renames a file in the underlying file system.
protected  boolean BasicDirectoryModel.lt(File a, File b)
           
protected  boolean BasicDirectoryModel.lt(File a, File b)
           
 

Uses of File in javax.swing.plaf.metal
 

Methods in javax.swing.plaf.metal with parameters of type File
 void MetalFileChooserUI.ensureFileIsVisible(JFileChooser fc, File f)
           
 

Uses of File in javax.swing.plaf.multi
 

Methods in javax.swing.plaf.multi with parameters of type File
 void MultiFileChooserUI.ensureFileIsVisible(JFileChooser a, File b)
          Invokes the ensureFileIsVisible method on each UI handled by this object.
 

Uses of File in javax.xml.parsers
 

Methods in javax.xml.parsers with parameters of type File
 void SAXParser.parse(File f, HandlerBase hb)
          Parse the content of the file specified as XML using the specified HandlerBase.
 void SAXParser.parse(File f, DefaultHandler dh)
          Parse the content of the file specified as XML using the specified DefaultHandler.
 Document DocumentBuilder.parse(File f)
          Parse the content of the given file as an XML document and return a new DOM Document object.
 

Uses of File in javax.xml.transform.stream
 

Methods in javax.xml.transform.stream with parameters of type File
 void StreamSource.setSystemId(File f)
          Set the system ID from a File reference.
 void StreamResult.setSystemId(File f)
          Set the system ID from a File reference.
 

Constructors in javax.xml.transform.stream with parameters of type File
StreamSource(File f)
          Construct a StreamSource from a File.
StreamResult(File f)
          Construct a StreamResult from a File.
 


JavaTM 2 Platform
Std. Ed. v1.4.1

Submit a bug or feature
For further API reference and developer documentation, see Java 2 SDK SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.

Copyright 2002 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.