summaryrefslogtreecommitdiff
path: root/lib/readbytes.rb
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-07-31 06:34:10 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-07-31 06:34:10 +0000
commit17c3d539f008c3ad4179e520511b6a64fb4ba969 (patch)
tree6a277eed8c128f9212b0ef8316750e697701059d /lib/readbytes.rb
parentdc136c12ee4d704de7621408ab0a5d9108284b45 (diff)
* ruby.h: use ifdef (or defined) for macro constants that may or
may not be defined to shut up gcc's -Wundef warnings. [ruby-core:08447] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10648 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/readbytes.rb')
-rw-r--r--lib/readbytes.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/readbytes.rb b/lib/readbytes.rb
index d6a3b10afe..08b92da73c 100644
--- a/lib/readbytes.rb
+++ b/lib/readbytes.rb
@@ -12,6 +12,11 @@ class TruncatedDataError<IOError
end
class IO
+ # reads exactly n bytes from the IO stream.
+ # If the data read is nil, raises EOFError.
+ # If the data read is too short, raises TruncatedDataError.
+ # The method TruncatedDataError#data may be used to obtain
+ # the truncated message.
def readbytes(n)
str = read(n)
if str == nil