Overview | Methods | This Package | All Packages
Creates a File object given a new or existing file.
Syntax
public File( String path, int mode, int access, int share)
public File( int handle )
public File( int handle, boolean owned )
Parameters
path
The path of the file to create or open.
mode
The mode used to open the file. Can be any value from the FileMode enumeration.
access
The access to the file. Can be any value from the FileAccess enumeration.
share
The share access that the file will support when opened. Can be any value from the FileShare enumeration.
handle
An existing file handle.
owned
specifies whether the File object owns the handle.
Exceptions
WinIOException thrown if an error occurs.
Remarks
The owned parameter specifies whether the File object owns the specified handle. A file handle that is not owned is not automatically closed when the close method is called or when the File object is released through garbage collection.
The specified handle parameter is considered to be externally managed and is not automatically closed when the close method is called or when the File object is released through garbage collection.
The designated file is created or opened according to the specified access, mode, and share parameters. The file remains open until the close method is called or until the File object is released through garbage collection. Following a call to close, any operations on the file will raise exceptions.
See Also close, create, open, openRead, openStandardError, openStandardInput, openStandardOutput