|
41 | 41 | (common/stream-reducer this f init))) |
42 | 42 |
|
43 | 43 | (defn open-read |
44 | | - {:doc "Open a file for reading, returning a IInputStream" |
| 44 | + {:doc "Opens a file for reading. Returns an IInputStream." |
45 | 45 | :added "0.1"} |
46 | 46 | [filename] |
47 | 47 | (assert (string? filename) "Filename must be a string") |
|
95 | 95 | (throw [::Exception "Expected a LineReader, UTF8InputStream, or BufferedInputStream"]))) |
96 | 96 |
|
97 | 97 | (defn read-line |
98 | | - "Read one line from input-stream for each invocation. |
99 | | - nil when all lines have been read. |
| 98 | + "Reads one line from input-stream for each invocation. |
| 99 | + Returns nil when all lines have been read. |
100 | 100 | Pass a BufferedInputStream for best performance." |
101 | 101 | [input-stream] |
102 | 102 | (-read-line (line-reader input-stream))) |
103 | 103 |
|
104 | 104 | (defn line-seq |
105 | 105 | "Returns the lines of text from input-stream as a lazy sequence of strings. |
106 | | - input-stream must implement IInputStream" |
| 106 | + input-stream must implement IInputStream." |
107 | 107 | [input-stream] |
108 | 108 | (let [lr (line-reader input-stream)] |
109 | 109 | (when-let [line (-read-line lr)] |
|
213 | 213 | result) |
214 | 214 |
|
215 | 215 | (defn open-write |
216 | | - {:doc "Open a file for writing, returning a IOutputStream" |
| 216 | + {:doc "Opens a file for writing. Returns an IOutputStream." |
217 | 217 | :added "0.1"} |
218 | 218 | [filename] |
219 | 219 | (assert (string? filename) "Filename must be a string") |
|
244 | 244 |
|
245 | 245 | :else (throw [::Exception "Expected a string or IOutputStream"]))) |
246 | 246 |
|
247 | | -(defn slurp |
248 | | - "Reads in the contents of input. Input must be a filename or an IInputStream" |
| 247 | +(defn slurp |
| 248 | + "Reads in the contents of input. Input must be a filename or an IInputStream." |
249 | 249 | [input] |
250 | 250 | (let [stream (cond |
251 | 251 | (string? input) (open-read input) |
|
0 commit comments