mruby-io
IO#getc
Character (multi-byte UTF-8) is destroyed when character spanning `IO::BUF_SIZE` (4096 bytes) exist. - Prepare file: ```ruby File.open("sample", "wb") { |f| f << "●" * 1370 } ``` - Before patched: ```ruby File.open("sample") { |f| a = []; while ch = f.getc; a << ch; end; p a } # => ["●", "●", ..., "●", "\xe2", "\x97", "\x8f", "●", "●", "●", "●"] - After patched: ```ruby File.open("sample") { |f| a = []; while ch = f.getc; a << ch; end; p a } # => ["●", "●", ..., "●", "●", "●", "●", "●", "●"]
IO#pos
8c90b5fc6
`IO#readline` and `IO#readchar` process in character units.
String#byteslice
IO._bufread
`byteslice` creates 2 string objects. `_bufread` creates one, and modifies the original buffer string, that is more efficient.
$/
1. `$/` and other Perl-ish global variables are not defined in ISO. 2. The current Ruby policy do not encourage those variables. 3. Those variables has global effect and can cause troubles.
length
E.g. `io.read(5)` should read 5 byte string, not 5 characters.
IO.sysopen
IO.open
IO.read
git-subtree-dir: mrbgems/mruby-io git-subtree-mainline: 10ed730e4b git-subtree-split: 3c8e1f94c4
10ed730e4b
3c8e1f94c4