Add PipedInputStream and PipedOutputStream
This commit is contained in:
parent
a152a44c87
commit
51133263f2
2 changed files with 14 additions and 0 deletions
|
|
@ -93,8 +93,10 @@
|
|||
java.io.FilenameFilter
|
||||
java.io.FileNotFoundException
|
||||
java.io.InputStream
|
||||
java.io.PipedInputStream
|
||||
java.io.IOException
|
||||
java.io.OutputStream
|
||||
java.io.PipedOutputStream
|
||||
java.io.FileReader
|
||||
java.io.InputStreamReader
|
||||
java.io.PushbackInputStream
|
||||
|
|
|
|||
12
test/babashka/java_io_piped_stream_test.clj
Normal file
12
test/babashka/java_io_piped_stream_test.clj
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
(ns babashka.java-io-piped-stream-test
|
||||
(:require [clojure.test :as test :refer [deftest is]])
|
||||
(:import [java.io PipedInputStream PipedOutputStream]))
|
||||
|
||||
(deftest piped-stream-test
|
||||
(let [pis (PipedInputStream.)
|
||||
pos (PipedOutputStream.)
|
||||
char-seq [66 97 98 97 115 104 107 97]
|
||||
_ (.connect pis pos)
|
||||
_ (doseq [c char-seq]
|
||||
(.write pos c))]
|
||||
(is (= "Babashka" (apply str (for [_ char-seq] (char (.read pis))))))))
|
||||
Loading…
Reference in a new issue