D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
IO
/
Filename :
copy_stream-c.ri
back
Copy
U:RDoc::AnyMethod[iI"copy_stream:ETI"IO::copy_stream;TT:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"5Copies from the given +src+ to the given +dst+, ;TI"*returning the number of bytes copied.;To:RDoc::Markup::BlankLine o:RDoc::Markup::List: @type:BULLET:@items[o:RDoc::Markup::ListItem:@label0; [o; ; [I"2The given +src+ must be one of the following:;T@o;; ;;[o;;0; [o; ; [I"GThe path to a readable file, from which source data is to be read.;To;;0; [o; ; [I"FAn \IO-like object, opened for reading and capable of responding ;TI"0to method +:readpartial+ or method +:read+.;T@o;;0; [o; ; [I"2The given +dst+ must be one of the following:;T@o;; ;;[o;;0; [o; ; [I"AThe path to a writable file, to which data is to be written.;To;;0; [o; ; [I"FAn \IO-like object, opened for writing and capable of responding ;TI"to method +:write+.;T@o; ; [I"9The examples here use file <tt>t.txt</tt> as source:;T@o:RDoc::Markup::Verbatim; [I"File.read('t.txt') ;TI"A# => "First line\nSecond line\n\nThird line\nFourth line\n" ;TI"%File.read('t.txt').size # => 47 ;T:@format0o; ; [I"2If only arguments +src+ and +dst+ are given, ;TI"(the entire source stream is copied:;T@o;; [I"# Paths. ;TI"/IO.copy_stream('t.txt', 't.tmp') # => 47 ;TI" ;TI"/# IOs (recall that a File is also an IO). ;TI"9src_io = File.open('t.txt', 'r') # => #<File:t.txt> ;TI"9dst_io = File.open('t.tmp', 'w') # => #<File:t.tmp> ;TI".IO.copy_stream(src_io, dst_io) # => 47 ;TI"src_io.close ;TI"dst_io.close ;T;0o; ; [I"8With argument +src_length+ a non-negative integer, ;TI"-no more than that many bytes are copied:;T@o;; [I"2IO.copy_stream('t.txt', 't.tmp', 10) # => 10 ;TI"<File.read('t.tmp') # => "First line" ;T;0o; ; [I",With argument +src_offset+ also given, ;TI"8the source stream is read beginning at that offset:;T@o;; [I"6IO.copy_stream('t.txt', 't.tmp', 11, 11) # => 11 ;TI"@IO.read('t.tmp') # => "Second line";T;0: @fileI" io.c;T:0@omit_headings_from_table_of_contents_below0I"KIO.copy_stream(src, dst, src_length = nil, src_offset = 0) -> integer ;T0[ I"(p1, p2, p3 = v3, p4 = v4);T@]FI"IO;TcRDoc::NormalClass00