diff --git a/src/io.cr b/src/io.cr index 28a3652c9e4c..c159c77776b5 100644 --- a/src/io.cr +++ b/src/io.cr @@ -563,10 +563,7 @@ abstract class IO decoder.write(str) end else - buffer = uninitialized UInt8[DEFAULT_BUFFER_SIZE] - while (read_bytes = read(buffer.to_slice)) > 0 - str.write buffer.to_slice[0, read_bytes] - end + IO.copy(self, str) end end end