From e6ccffd96619ab4c7926eaa96fbc8166024201d4 Mon Sep 17 00:00:00 2001 From: naruse Date: Mon, 3 May 2010 22:17:49 +0000 Subject: Add rdoc about IO#read(length). [ruby-core:29161] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27604 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- io.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'io.c') diff --git a/io.c b/io.c index 1b9124134e..c72caae3b9 100644 --- a/io.c +++ b/io.c @@ -2095,14 +2095,15 @@ rb_io_write_nonblock(VALUE io, VALUE str) * * Reads length bytes from the I/O stream. * - * length must be a non-negative integer or nil. + * length must be a non-negative integer or nil. * * If length is a positive integer, - * it try to read length bytes. - * It returns nil or a string which length is 1 to length bytes. - * nil means it met EOF at beginning. + * it try to read length bytes without any conversion (binary mode). + * It returns nil or a string whose length is 1 to length bytes. + * nil means it met EOF at beginning. * The 1 to length-1 bytes string means it met EOF after reading the result. * The length bytes string means it doesn't meet EOF. + * The resulted string is always ASCII-8BIT encoding. * * If length is omitted or is nil, * it reads until EOF and the encoding conversion is applied. @@ -2117,7 +2118,7 @@ rb_io_write_nonblock(VALUE io, VALUE str) * depend on length. * ios.read() and * ios.read(nil) returns "". - * ios.read(positive-integer) returns nil. + * ios.read(positive-integer) returns nil. * * f = File.new("testfile") * f.read(16) #=> "This is line one" -- cgit v1.2.3