summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-05-03 22:17:49 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-05-03 22:17:49 +0000
commite6ccffd96619ab4c7926eaa96fbc8166024201d4 (patch)
treec270d35e0f872e7fd1442e5f849603f5ed0b7f6b /io.c
parent9526ba4ef3a2dadebac9f7e364ab2180eabe10aa (diff)
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
Diffstat (limited to 'io.c')
-rw-r--r--io.c11
1 files changed, 6 insertions, 5 deletions
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 <i>length</i> bytes from the I/O stream.
*
- * <i>length</i> must be a non-negative integer or nil.
+ * <i>length</i> must be a non-negative integer or <code>nil</code>.
*
* If <i>length</i> is a positive integer,
- * it try to read <i>length</i> bytes.
- * It returns nil or a string which length is 1 to <i>length</i> bytes.
- * nil means it met EOF at beginning.
+ * it try to read <i>length</i> bytes without any conversion (binary mode).
+ * It returns <code>nil</code> or a string whose length is 1 to <i>length</i> bytes.
+ * <code>nil</code> means it met EOF at beginning.
* The 1 to <i>length</i>-1 bytes string means it met EOF after reading the result.
* The <i>length</i> bytes string means it doesn't meet EOF.
+ * The resulted string is always ASCII-8BIT encoding.
*
* If <i>length</i> is omitted or is <code>nil</code>,
* it reads until EOF and the encoding conversion is applied.
@@ -2117,7 +2118,7 @@ rb_io_write_nonblock(VALUE io, VALUE str)
* depend on <i>length</i>.
* <code><i>ios</i>.read()</code> and
* <code><i>ios</i>.read(nil)</code> returns <code>""</code>.
- * <code><i>ios</i>.read(<i>positive-integer</i>)</code> returns nil.
+ * <code><i>ios</i>.read(<i>positive-integer</i>)</code> returns <code>nil</code>.
*
* f = File.new("testfile")
* f.read(16) #=> "This is line one"