Sdílet prostřednictvím


Reader.TransferTo(Writer) Method

Definition

Reads all characters from this reader and writes the characters to the given writer in the order that they are read.

[Android.Runtime.Register("transferTo", "(Ljava/io/Writer;)J", "GetTransferTo_Ljava_io_Writer_Handler", ApiSince=33)]
public virtual long TransferTo (Java.IO.Writer? out);
[<Android.Runtime.Register("transferTo", "(Ljava/io/Writer;)J", "GetTransferTo_Ljava_io_Writer_Handler", ApiSince=33)>]
abstract member TransferTo : Java.IO.Writer -> int64
override this.TransferTo : Java.IO.Writer -> int64

Parameters

out
Writer

the writer, non-null

Returns

the number of characters transferred

Attributes

Remarks

Reads all characters from this reader and writes the characters to the given writer in the order that they are read. On return, this reader will be at end of the stream. This method does not close either reader or writer.

This method may block indefinitely reading from the reader, or writing to the writer. The behavior for the case where the reader and/or writer is asynchronously closed, or the thread interrupted during the transfer, is highly reader and writer specific, and therefore not specified.

If an I/O error occurs reading from the reader or writing to the writer, then it may do so after some characters have been read or written. Consequently the reader may not be at end of the stream and one, or both, streams may be in an inconsistent state. It is strongly recommended that both streams be promptly closed if an I/O error occurs.

Added in 10.

Java documentation for java.io.Reader.transferTo(java.io.Writer).

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