Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
c.c.io provides input-stream and output-stream for byte-oriented I/O
clojure.contrib.io already supports character-oriented I/O through the multi-methods reader and writer. This patch adds support for byte-oriented I/O by providing the multi-methods input-stream and output-stream. * input-stream knows how to open InputStreams for reading bytes. * reader has been refactored to build on input-stream. * output-stream knows how to open OutputStreams for writing bytes. * writer has been refactored to build on output-stream (where sensible) By recognizing that output-stream will throw exceptions for us if it's unable to open the underlying resource, we were able to use the :default method to cover URL, URI and Socket. The String writer has not been touched. (Writing it in terms of output-stream would have made it longer and more complex.) * *append-to-writer* has been renamed to *append* for use with output-streams without souding foolish. This is a breaking change for clients that bind *append-to-writer* instead of calling append-writer or append-split as recommended in the docsting. * Like writer, output-stream consults the current binding of *append*. * append-output-stream is analagous to append-writer. Like append-writer, the implementation looks very general, but in reality it only works for files. Signed-off-by: Stuart Halloway <stu@thinkrelevance.com>
- Loading branch information
1 parent
b52f0b6
commit 9cd7b15
Showing
1 changed file
with
122 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters