@@ -508,6 +508,16 @@ defmodule IO do
508508 :io . get_line ( map_dev ( device ) , to_chardata ( prompt ) )
509509 end
510510
511+ @ doc """
512+ Returns a line-based `IO.Stream` on `:stdio`.
513+
514+ This is equivalent to:
515+
516+ IO.stream(:stdio, :line)
517+
518+ """
519+ def stream , do: stream ( :stdio , :line )
520+
511521 @ doc """
512522 Converts the IO `device` into an `IO.Stream`.
513523
@@ -533,12 +543,22 @@ defmodule IO do
533543
534544 """
535545 @ spec stream ( device , :line | pos_integer ) :: Enumerable . t ( )
536- def stream ( device , line_or_codepoints )
546+ def stream ( device \\ :stdio , line_or_codepoints )
537547 when line_or_codepoints == :line
538548 when is_integer ( line_or_codepoints ) and line_or_codepoints > 0 do
539549 IO.Stream . __build__ ( map_dev ( device ) , false , line_or_codepoints )
540550 end
541551
552+ @ doc """
553+ Returns a raw, line-based `IO.Stream` on `:stdio`. The operation is Unicode unsafe.
554+
555+ This is equivalent to:
556+
557+ IO.binstream(:stdio, :line)
558+
559+ """
560+ def binstream , do: binstream ( :stdio , :line )
561+
542562 @ doc """
543563 Converts the IO `device` into an `IO.Stream`. The operation is Unicode unsafe.
544564
@@ -547,18 +567,16 @@ defmodule IO do
547567 and write.
548568
549569 The `device` is iterated by the given number of bytes or line by line if
550- `:line` is given.
551- This reads from the IO device as a raw binary.
570+ `:line` is given. This reads from the IO device as a raw binary.
552571
553572 Note that an IO stream has side effects and every time
554573 you go over the stream you may get different results.
555574
556575 Finally, do not use this function on IO devices in Unicode
557576 mode as it will return the wrong result.
558-
559577 """
560578 @ spec binstream ( device , :line | pos_integer ) :: Enumerable . t ( )
561- def binstream ( device , line_or_bytes )
579+ def binstream ( device \\ :stdio , line_or_bytes )
562580 when line_or_bytes == :line
563581 when is_integer ( line_or_bytes ) and line_or_bytes > 0 do
564582 IO.Stream . __build__ ( map_dev ( device ) , true , line_or_bytes )
0 commit comments