File Constructors
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| File(URI) |
Creates a new |
| File(String) |
Creates a new |
| File(File, String) |
Creates a new |
| File(IntPtr, JniHandleOwnership) |
A constructor used when creating managed representations of JNI objects; called by the runtime. |
| File(String, String) |
Creates a new |
File(URI)
Creates a new File instance by converting the given
file: URI into an abstract pathname.
[Android.Runtime.Register(".ctor", "(Ljava/net/URI;)V", "")]
public File(Java.Net.URI uri);
[<Android.Runtime.Register(".ctor", "(Ljava/net/URI;)V", "")>]
new Java.IO.File : Java.Net.URI -> Java.IO.File
Parameters
- uri
- URI
An absolute, hierarchical URI with a scheme equal to
"file", a non-empty path component, and undefined
authority, query, and fragment components
- Attributes
Exceptions
if uri == null.
if uri does not comply with the conditions above.
Remarks
Creates a new File instance by converting the given file: URI into an abstract pathname.
The exact form of a file: URI is system-dependent, hence the transformation performed by this constructor is also system-dependent.
For a given abstract pathname f it is guaranteed that
<blockquote> new File( f. f#toURI() toURI()).equals(.</blockquote>#getAbsoluteFile() getAbsoluteFile())
so long as the original abstract pathname, the URI, and the new abstract pathname are all created in (possibly different invocations of) the same Java virtual machine. This relationship typically does not hold, however, when a file: URI that is created in a virtual machine on one operating system is converted into an abstract pathname in a virtual machine on a different operating system.
Added in 1.4.
Java documentation for java.io.File.File(java.net.URI).
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
See also
Applies to
File(String)
Creates a new File instance by converting the given
pathname string into an abstract pathname.
[Android.Runtime.Register(".ctor", "(Ljava/lang/String;)V", "")]
public File(string pathname);
[<Android.Runtime.Register(".ctor", "(Ljava/lang/String;)V", "")>]
new Java.IO.File : string -> Java.IO.File
Parameters
- pathname
- String
A pathname string
- Attributes
Exceptions
if path is null.
Remarks
Creates a new File instance by converting the given pathname string into an abstract pathname. If the given string is the empty string, then the result is the empty abstract pathname.
Java documentation for java.io.File.File(java.lang.String).
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
File(File, String)
Creates a new File instance from a parent abstract
pathname and a child pathname string.
[Android.Runtime.Register(".ctor", "(Ljava/io/File;Ljava/lang/String;)V", "")]
public File(Java.IO.File? parent, string child);
[<Android.Runtime.Register(".ctor", "(Ljava/io/File;Ljava/lang/String;)V", "")>]
new Java.IO.File : Java.IO.File * string -> Java.IO.File
Parameters
- parent
- File
The parent abstract pathname
- child
- String
The child pathname string
- Attributes
Exceptions
if name is null.
Remarks
Creates a new File instance from a parent abstract pathname and a child pathname string.
If parent is null then the new File instance is created as if by invoking the single-argument File constructor on the given child pathname string.
Otherwise the parent abstract pathname is taken to denote a directory, and the child pathname string is taken to denote either a directory or a file. If the child pathname string is absolute then it is converted into a relative pathname in a system-dependent way. If parent is the empty abstract pathname then the new File instance is created by converting child into an abstract pathname and resolving the result against a system-dependent default directory. Otherwise each pathname string is converted into an abstract pathname and the child abstract pathname is resolved against the parent.
Java documentation for java.io.File.File(java.io.File, java.lang.String).
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
File(IntPtr, JniHandleOwnership)
A constructor used when creating managed representations of JNI objects; called by the runtime.
protected File(IntPtr javaReference, Android.Runtime.JniHandleOwnership transfer);
new Java.IO.File : nativeint * Android.Runtime.JniHandleOwnership -> Java.IO.File
Parameters
- transfer
- JniHandleOwnership
A JniHandleOwnershipindicating how to handle javaReference
Remarks
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
File(String, String)
Creates a new File instance from a parent pathname string
and a child pathname string.
[Android.Runtime.Register(".ctor", "(Ljava/lang/String;Ljava/lang/String;)V", "")]
public File(string? parent, string child);
[<Android.Runtime.Register(".ctor", "(Ljava/lang/String;Ljava/lang/String;)V", "")>]
new Java.IO.File : string * string -> Java.IO.File
Parameters
- parent
- String
The parent pathname string
- child
- String
The child pathname string
- Attributes
Exceptions
if name == null.
Remarks
Creates a new File instance from a parent pathname string and a child pathname string.
If parent is null then the new File instance is created as if by invoking the single-argument File constructor on the given child pathname string.
Otherwise the parent pathname string is taken to denote a directory, and the child pathname string is taken to denote either a directory or a file. If the child pathname string is absolute then it is converted into a relative pathname in a system-dependent way. If parent is the empty string then the new File instance is created by converting child into an abstract pathname and resolving the result against a system-dependent default directory. Otherwise each pathname string is converted into an abstract pathname and the child abstract pathname is resolved against the parent.
Java documentation for java.io.File.File(java.lang.String, java.lang.String).
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.