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

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


Java™ Platform
Standard Ed. 6

Uses of Class
java.io.File

Packages that use File
java.awt Contains all of the classes for creating user interfaces and for painting graphics and images. 
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.security Provides the classes and interfaces for the security framework. 
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). 
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.activation   
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.tools Provides interfaces for tools which can be invoked from a program, for example, compilers. 
javax.xml.bind Provides a runtime binding framework for client applications including unmarshalling, marshalling, and validation capabilities. 
javax.xml.bind.helpers JAXB Provider Use Only: Provides partial default implementations for some of the javax.xml.bind interfaces. 
javax.xml.parsers Provides classes allowing the processing of XML documents. 
javax.xml.transform.stream This package implements stream- and URI- specific transformation APIs. 
javax.xml.validation This package provides an API for validation of XML documents. 
 

Uses of File in java.awt
 

Methods in java.awt with parameters of type File
static Font Font.createFont(int fontFormat, File fontFile)
          Returns a new Font using the specified font type and the specified font file.
 void Desktop.edit(File file)
          Launches the associated editor application and opens a file for editing.
 void Desktop.open(File file)
          Launches the associated application to open the file.
 void Desktop.print(File file)
          Prints a file with the native desktop printing facility, using the associated application's print command.
 

Uses of File in java.io
 

Methods in java.io that return File
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.
 

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.
 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.
 

Constructors in java.io with parameters of type File
File(File parent, String child)
          Creates a new File instance from a parent abstract pathname and a child pathname string.
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.
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.
FileReader(File file)
          Creates a new FileReader, given the File to read from.
FileWriter(File file)
          Constructs a FileWriter object given a File object.
FileWriter(File file, boolean append)
          Constructs a FileWriter object given a File object.
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.
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.
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.
 

Uses of File in java.lang
 

Methods in java.lang that return File
 File ProcessBuilder.directory()
          Returns this process builder's working directory.
 

Methods in java.lang with parameters of type File
 ProcessBuilder ProcessBuilder.directory(File directory)
          Sets this process builder's 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.
 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.
 

Uses of File in java.security
 

Methods in java.security with parameters of type File
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
 

Constructors in java.util with parameters of type File
Formatter(File file)
          Constructs a new formatter with the specified file.
Formatter(File file, String csn)
          Constructs a new formatter with the specified file and charset.
Formatter(File file, String csn, Locale l)
          Constructs a new formatter with the specified file, charset, and locale.
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.
 

Uses of File in java.util.jar
 

Methods in java.util.jar with parameters of type File
 void Pack200.Unpacker.unpack(File in, JarOutputStream out)
          Read a Pack200 archive, and write the encoded JAR to a JarOutputStream.
 

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)
          Opens a ZIP file for reading given the specified File object.
ZipFile(File file, int mode)
          Opens a new ZipFile to read from the specified File object in the specified mode.
 

Uses of File in javax.activation
 

Methods in javax.activation that return File
 File FileDataSource.getFile()
          Return the File object that corresponds to this FileDataSource.
 

Methods in javax.activation with parameters of type File
 String MimetypesFileTypeMap.getContentType(File f)
          Return the MIME type of the file object.
abstract  String FileTypeMap.getContentType(File file)
          Return the type of the file object.
 

Constructors in javax.activation with parameters of type File
FileDataSource(File file)
          Creates a FileDataSource from a 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 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 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 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  ImageInputStream ImageInputStreamSpi.createInputStreamInstance(Object input, boolean useCache, File cacheDir)
          Returns an instance of the ImageInputStream implementation associated with this service provider.
abstract  ImageOutputStream ImageOutputStreamSpi.createOutputStreamInstance(Object output, boolean useCache, File cacheDir)
          Returns an instance of the ImageOutputStream implementation associated with this service provider.
 

Uses of File in javax.imageio.stream
 

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

Uses of File in javax.sound.midi
 

Methods in javax.sound.midi with parameters of type 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 Soundbank MidiSystem.getSoundbank(File file)
          Constructs a Soundbank by reading it 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  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  Soundbank SoundbankReader.getSoundbank(File file)
          Obtains a soundbank object 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  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.
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
 

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

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

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.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.
protected  File FileSystemView.createFileSystemRoot(File f)
          Creates a new File object for f 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.getChild(File parent, String fileName)
           
 File FileSystemView.getDefaultDirectory()
          Return the user's default starting directory for the file chooser.
 File[] FileSystemView.getFiles(File dir, boolean useFileHiding)
          Gets the list of shown (i.e.
 File FileSystemView.getHomeDirectory()
           
 File FileSystemView.getParentDirectory(File dir)
          Returns the parent directory of dir.
 File[] FileSystemView.getRoots()
          Returns all root partitions on this system.
 

Methods in javax.swing.filechooser with parameters of type File
 boolean FileNameExtensionFilter.accept(File f)
          Tests the specified file, returning true if the file is accepted, false otherwise.
abstract  boolean FileFilter.accept(File f)
          Whether the given file is accepted by this filter.
 File 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 new File object for f 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.getChild(File parent, String fileName)
           
 String FileView.getDescription(File f)
          A human readable description of the file.
 File[] FileSystemView.getFiles(File dir, boolean useFileHiding)
          Gets the list of shown (i.e.
 Icon FileView.getIcon(File f)
          The icon that represents this file in the JFileChooser.
 String FileView.getName(File f)
          The name of the file.
 File FileSystemView.getParentDirectory(File dir)
          Returns the parent directory of dir.
 String FileSystemView.getSystemDisplayName(File f)
          Name of 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.
 String FileSystemView.getSystemTypeDescription(File f)
          Type description for a file, directory, or folder as it would be displayed in a system file browser.
 String 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 FileSystemView.isDrive(File dir)
          Used by UI classes to decide whether to display a special icon for drives or partitions, e.g.
 boolean FileSystemView.isFileSystem(File f)
          Checks if f 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 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.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.
 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
 

Fields in javax.swing.plaf.basic with type parameters of type File
protected  Hashtable<File,Icon> BasicFileChooserUI.BasicFileView.iconCache
           
 

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 that return types with arguments of type File
 Vector<File> BasicDirectoryModel.getDirectories()
           
 Vector<File> BasicDirectoryModel.getFiles()
           
 

Methods in javax.swing.plaf.basic with parameters of type File
 boolean BasicFileChooserUI.AcceptAllFileFilter.accept(File f)
           
 void BasicFileChooserUI.BasicFileView.cacheIcon(File f, Icon i)
           
 void BasicFileChooserUI.ensureFileIsVisible(JFileChooser fc, File f)
           
 Icon BasicFileChooserUI.BasicFileView.getCachedIcon(File f)
           
 String BasicFileChooserUI.BasicFileView.getDescription(File f)
           
 Icon BasicFileChooserUI.BasicFileView.getIcon(File f)
           
 String BasicFileChooserUI.BasicFileView.getName(File f)
           
 String BasicFileChooserUI.BasicFileView.getTypeDescription(File f)
           
 Boolean BasicFileChooserUI.BasicFileView.isHidden(File f)
           
protected  boolean BasicDirectoryModel.lt(File a, File b)
           
 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.
 

Method parameters in javax.swing.plaf.basic with type arguments of type File
protected  void BasicDirectoryModel.sort(Vector<? extends File> v)
           
 

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.tools
 

Methods in javax.tools that return types with arguments of type File
 Iterable<? extends File> StandardJavaFileManager.getLocation(JavaFileManager.Location location)
          Gets the path associated with the given location.
 

Methods in javax.tools with parameters of type File
 Iterable<? extends JavaFileObject> StandardJavaFileManager.getJavaFileObjects(File... files)
          Gets file objects representing the given files.
 

Method parameters in javax.tools with type arguments of type File
 Iterable<? extends JavaFileObject> StandardJavaFileManager.getJavaFileObjectsFromFiles(Iterable<? extends File> files)
          Gets file objects representing the given files.
 void StandardJavaFileManager.setLocation(JavaFileManager.Location location, Iterable<? extends File> path)
          Associates the given path with the given location.
 

Uses of File in javax.xml.bind
 

Methods in javax.xml.bind with parameters of type File
 Object Unmarshaller.unmarshal(File f)
          Unmarshal XML data from the specified file and return the resulting content tree.
 

Uses of File in javax.xml.bind.helpers
 

Methods in javax.xml.bind.helpers with parameters of type File
 Object AbstractUnmarshallerImpl.unmarshal(File f)
           
 

Uses of File in javax.xml.parsers
 

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

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
StreamResult(File f)
          Construct a StreamResult from a File.
StreamSource(File f)
          Construct a StreamSource from a File.
 

Uses of File in javax.xml.validation
 

Methods in javax.xml.validation with parameters of type File
 Schema SchemaFactory.newSchema(File schema)
          Parses the specified File as a schema and returns it as a Schema.
 


Java™ Platform
Standard Ed. 6

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

Copyright 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.