You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: doc/stdlib/io-network.rst
+15-21
Original file line number
Diff line number
Diff line change
@@ -65,7 +65,7 @@ General I/O
65
65
66
66
Apply the function ``f`` to the result of ``open(args...)`` and close the resulting file descriptor upon completion.
67
67
68
-
**Example**: ``open(readall, "file.txt")``
68
+
**Example**: ``open(readstring, "file.txt")``
69
69
70
70
.. function:: IOBuffer() -> IOBuffer
71
71
@@ -121,11 +121,11 @@ General I/O
121
121
122
122
Close an I/O stream. Performs a ``flush`` first.
123
123
124
-
.. function:: write(stream, x)
124
+
.. function:: write(stream or filename, x)
125
125
126
126
.. Docstring generated from Julia source
127
127
128
-
Write the canonical binary representation of a value to the given stream. Returns the number of bytes written into the stream.
128
+
Write the canonical binary representation of a value to the given stream or file. Returns the number of bytes written into the stream.
129
129
130
130
You can write multiple values with the same :func:``write`` call. i.e. the following are equivalent:
131
131
@@ -146,7 +146,7 @@ General I/O
146
146
147
147
Read a series of values of the given type from a stream, in canonical binary representation. ``dims`` is either a tuple or a series of integer arguments specifying the size of ``Array`` to return.
148
148
149
-
.. function:: read!(stream, array::Array)
149
+
.. function:: read!(stream or filename, array::Array)
150
150
151
151
.. Docstring generated from Julia source
152
152
@@ -158,9 +158,9 @@ General I/O
158
158
159
159
Read at most ``nb`` bytes from the stream into ``b``\ , returning the number of bytes read (increasing the size of ``b`` as needed).
160
160
161
-
See ``readbytes`` for a description of the ``all`` option.
161
+
See ``read`` for a description of the ``all`` option.
Read the entirety of ``x`` as a string but remove trailing newlines. Equivalent to ``chomp(readall(x))``\ .
333
+
Read the entirety of ``x`` as a string but remove trailing newlines. Equivalent to ``chomp(readstring(x))``\ .
334
334
335
335
.. function:: truncate(file,n)
336
336
@@ -493,41 +493,35 @@ Text I/O
493
493
494
494
Show all structure of a value, including all fields of objects.
495
495
496
-
.. function:: readall(stream::IO)
496
+
.. function:: readstring(stream or filename)
497
497
498
498
.. Docstring generated from Julia source
499
499
500
-
Read the entire contents of an I/O stream as a string.
500
+
Read the entire contents of an I/O stream or a file as a string.
501
501
502
-
.. function:: readall(filename::AbstractString)
502
+
.. function:: readline(stream=STDIN or filename)
503
503
504
504
.. Docstring generated from Julia source
505
505
506
-
Open ``filename``\ , read the entire contents as a string, then close the file. Equivalent to ``open(readall, filename)``\ .
506
+
Read a single line of text, including a trailing newline character (if one is reached before the end of the input), from the given stream or file (defaults to ``STDIN``\ ),
507
507
508
-
.. function:: readline(stream=STDIN)
509
-
510
-
.. Docstring generated from Julia source
511
-
512
-
Read a single line of text, including a trailing newline character (if one is reached before the end of the input), from the given ``stream`` (defaults to ``STDIN``\ ),
513
-
514
-
.. function:: readuntil(stream, delim)
508
+
.. function:: readuntil(stream or filename, delim)
515
509
516
510
.. Docstring generated from Julia source
517
511
518
512
Read a string, up to and including the given delimiter byte.
519
513
520
-
.. function:: readlines(stream)
514
+
.. function:: readlines(stream or filename)
521
515
522
516
.. Docstring generated from Julia source
523
517
524
518
Read all lines as an array.
525
519
526
-
.. function:: eachline(stream)
520
+
.. function:: eachline(stream or filename)
527
521
528
522
.. Docstring generated from Julia source
529
523
530
-
Create an iterable object that will yield each line from a stream.
524
+
Create an iterable object that will yield each line.
0 commit comments