Files.Copy 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
Copy(IPath, Stream) |
Copies all bytes from a file to an output stream. |
Copy(IPath, IPath, ICopyOption[]) |
Reads all bytes from an input stream and writes them to an output stream. |
Copy(Stream, IPath, ICopyOption[]) |
Reads all bytes from an input stream and writes them to an output stream. |
Copy(IPath, Stream)
Copies all bytes from a file to an output stream.
[Android.Runtime.Register("copy", "(Ljava/nio/file/Path;Ljava/io/OutputStream;)J", "", ApiSince=26)]
public static long Copy (Java.Nio.FileNio.IPath? source, System.IO.Stream? out);
[<Android.Runtime.Register("copy", "(Ljava/nio/file/Path;Ljava/io/OutputStream;)J", "", ApiSince=26)>]
static member Copy : Java.Nio.FileNio.IPath * System.IO.Stream -> int64
Parameters
- source
- IPath
the path to the file
- out
- Stream
the output stream to write to
Returns
the number of bytes read or written
- Attributes
Remarks
Copies all bytes from a file to an output stream.
If an I/O error occurs reading from the file or writing to the output stream, then it may do so after some bytes have been read or written. Consequently the output stream may be in an inconsistent state. It is strongly recommended that the output stream be promptly closed if an I/O error occurs.
This method may block indefinitely writing to the output stream (or reading from the file). The behavior for the case that the output stream is asynchronously closed or the thread interrupted during the copy is highly output stream and file system provider specific and therefore not specified.
Note that if the given output stream is java.io.Flushable
then its java.io.Flushable#flush flush
method may need to invoked after this method completes so as to flush any buffered output.
Java documentation for java.nio.file.Files.copy(java.nio.file.Path, java.io.OutputStream)
.
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
Copy(IPath, IPath, ICopyOption[])
Reads all bytes from an input stream and writes them to an output stream.
[Android.Runtime.Register("copy", "(Ljava/nio/file/Path;Ljava/nio/file/Path;[Ljava/nio/file/CopyOption;)Ljava/nio/file/Path;", "", ApiSince=26)]
public static Java.Nio.FileNio.IPath? Copy (Java.Nio.FileNio.IPath? source, Java.Nio.FileNio.IPath? target, params Java.Nio.FileNio.ICopyOption[]? options);
[<Android.Runtime.Register("copy", "(Ljava/nio/file/Path;Ljava/nio/file/Path;[Ljava/nio/file/CopyOption;)Ljava/nio/file/Path;", "", ApiSince=26)>]
static member Copy : Java.Nio.FileNio.IPath * Java.Nio.FileNio.IPath * Java.Nio.FileNio.ICopyOption[] -> Java.Nio.FileNio.IPath
Parameters
- source
- IPath
- target
- IPath
- options
- ICopyOption[]
Returns
- Attributes
Remarks
Java documentation for java.nio.file.Files.copy(java.io.InputStream, java.io.OutputStream)
.
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
Copy(Stream, IPath, ICopyOption[])
Reads all bytes from an input stream and writes them to an output stream.
[Android.Runtime.Register("copy", "(Ljava/io/InputStream;Ljava/nio/file/Path;[Ljava/nio/file/CopyOption;)J", "", ApiSince=26)]
public static long Copy (System.IO.Stream? in, Java.Nio.FileNio.IPath? target, params Java.Nio.FileNio.ICopyOption[]? options);
[<Android.Runtime.Register("copy", "(Ljava/io/InputStream;Ljava/nio/file/Path;[Ljava/nio/file/CopyOption;)J", "", ApiSince=26)>]
static member Copy : System.IO.Stream * Java.Nio.FileNio.IPath * Java.Nio.FileNio.ICopyOption[] -> int64
Parameters
- in
- Stream
- target
- IPath
- options
- ICopyOption[]
Returns
- Attributes
Remarks
Java documentation for java.nio.file.Files.copy(java.io.InputStream, java.io.OutputStream)
.
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.