Files.Write Method
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
| Name | Description |
|---|---|
| Write(IPath, IIterable, IOpenOption[]) |
Write lines of text to a file. |
| Write(IPath, Byte[], IOpenOption[]) |
Writes bytes to a file. |
| Write(IPath, IIterable, Charset, IOpenOption[]) |
Write lines of text to a file. |
Write(IPath, IIterable, IOpenOption[])
Write lines of text to a file.
[Android.Runtime.Register("write", "(Ljava/nio/file/Path;Ljava/lang/Iterable;[Ljava/nio/file/OpenOption;)Ljava/nio/file/Path;", "", ApiSince=26)]
public static Java.Nio.FileNio.IPath? Write(Java.Nio.FileNio.IPath? path, Java.Lang.IIterable? lines, params Java.Nio.FileNio.IOpenOption[]? options);
[<Android.Runtime.Register("write", "(Ljava/nio/file/Path;Ljava/lang/Iterable;[Ljava/nio/file/OpenOption;)Ljava/nio/file/Path;", "", ApiSince=26)>]
static member Write : Java.Nio.FileNio.IPath * Java.Lang.IIterable * Java.Nio.FileNio.IOpenOption[] -> Java.Nio.FileNio.IPath
Parameters
- path
- IPath
the path to the file
- lines
- IIterable
an object to iterate over the char sequences
- options
- IOpenOption[]
options specifying how the file is opened
Returns
the path
- Attributes
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
Write(IPath, Byte[], IOpenOption[])
Writes bytes to a file.
[Android.Runtime.Register("write", "(Ljava/nio/file/Path;[B[Ljava/nio/file/OpenOption;)Ljava/nio/file/Path;", "", ApiSince=26)]
public static Java.Nio.FileNio.IPath? Write(Java.Nio.FileNio.IPath? path, byte[]? bytes, params Java.Nio.FileNio.IOpenOption[]? options);
[<Android.Runtime.Register("write", "(Ljava/nio/file/Path;[B[Ljava/nio/file/OpenOption;)Ljava/nio/file/Path;", "", ApiSince=26)>]
static member Write : Java.Nio.FileNio.IPath * byte[] * Java.Nio.FileNio.IOpenOption[] -> Java.Nio.FileNio.IPath
Parameters
- path
- IPath
the path to the file
- bytes
- Byte[]
the byte array with the bytes to write
- options
- IOpenOption[]
options specifying how the file is opened
Returns
the path
- Attributes
Exceptions
if options contains an invalid combination of options
if an I/O error occurs writing to or creating the file
if an unsupported option is specified
In the case of the default provider, and a security manager is installed, the checkWrite method is invoked to check write access to the file. The checkDelete method is invoked to check delete access if the file is opened with the DELETE_ON_CLOSE option.
Remarks
Java reference for java.nio.file.Files.write.
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
Write(IPath, IIterable, Charset, IOpenOption[])
Write lines of text to a file.
[Android.Runtime.Register("write", "(Ljava/nio/file/Path;Ljava/lang/Iterable;Ljava/nio/charset/Charset;[Ljava/nio/file/OpenOption;)Ljava/nio/file/Path;", "", ApiSince=26)]
public static Java.Nio.FileNio.IPath? Write(Java.Nio.FileNio.IPath? path, Java.Lang.IIterable? lines, Java.Nio.Charset.Charset? cs, params Java.Nio.FileNio.IOpenOption[]? options);
[<Android.Runtime.Register("write", "(Ljava/nio/file/Path;Ljava/lang/Iterable;Ljava/nio/charset/Charset;[Ljava/nio/file/OpenOption;)Ljava/nio/file/Path;", "", ApiSince=26)>]
static member Write : Java.Nio.FileNio.IPath * Java.Lang.IIterable * Java.Nio.Charset.Charset * Java.Nio.FileNio.IOpenOption[] -> Java.Nio.FileNio.IPath
Parameters
- path
- IPath
the path to the file
- lines
- IIterable
an object to iterate over the char sequences
- cs
- Charset
the charset to use for encoding
- options
- IOpenOption[]
options specifying how the file is opened
Returns
the path
- Attributes
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.