diff --git a/src/babashka/impl/proxy.clj b/src/babashka/impl/proxy.clj index 7e4ad722..665be140 100644 --- a/src/babashka/impl/proxy.clj +++ b/src/babashka/impl/proxy.clj @@ -79,6 +79,18 @@ (handle [sig] ((method-or-bust methods 'handle) this sig))) + ["java.io.InputStream" #{}] + (proxy [java.io.InputStream] [] + (available [] ((method-or-bust methods 'available) this)) + (close [] ((method-or-bust methods 'close) this)) + (read + ([] + ((method-or-bust methods 'read) this)) + ([bs] + ((method-or-bust methods 'read) this bs)) + ([bs off len] + ((method-or-bust methods 'read) this bs off len)))) + ["java.io.PipedInputStream" #{}] (proxy [java.io.PipedInputStream] [] (available [] ((method-or-bust methods 'available) this)) diff --git a/test-resources/proxy_inputstream_outputstream.bb b/test-resources/proxy_inputstream_outputstream.bb index 8b2aac6f..65b2c654 100644 --- a/test-resources/proxy_inputstream_outputstream.bb +++ b/test-resources/proxy_inputstream_outputstream.bb @@ -108,5 +108,4 @@ (read-all) (write-byte-by-byte) (write-byte-array)) - (println "Success") - :success) + (println ":success")) diff --git a/test/babashka/interop_test.clj b/test/babashka/interop_test.clj index 411d50e1..59e88287 100644 --- a/test/babashka/interop_test.clj +++ b/test/babashka/interop_test.clj @@ -26,6 +26,9 @@ (deftest byte-channels-test (is (= :success (bb nil (slurp "test-resources/bytechannel_and_related_classes.bb"))))) +(deftest proxy-inputstream-outputstream-test + (is (= :success (bb nil (slurp "test-resources/proxy_inputstream_outputstream.bb"))))) + (deftest map-entry-create-test (is (true? (bb nil "(= (first {1 2}) (clojure.lang.MapEntry. 1 2)