Back
default-streams-impl (clj)
(source)variable
Examples
metosin/muuntaja
(ns muuntaja.protocols
(:require [clojure.java.io :as io]
[muuntaja.util :as util])
(:import (clojure.lang IFn AFn)
(java.io ByteArrayOutputStream ByteArrayInputStream InputStreamReader BufferedReader InputStream Writer OutputStream FileInputStream File)))
(extend StreamableResponse
io/IOFactory
(assoc io/default-streams-impl
:make-input-stream (fn [^StreamableResponse this _]
(with-open [out (ByteArrayOutputStream. 4096)]
((.f this) out)
(ByteArrayInputStream.
(.toByteArray out))))
:make-reader (fn [^StreamableResponse this _]
(with-open [out (ByteArrayOutputStream. 4096)]
((.f this) out)
(BufferedReader.
(InputStreamReader.
(ByteArrayInputStream.
(.toByteArray out))))))))
aliostad/deep-learning-lang-detection
(ns muuntaja.protocols
(:require [clojure.java.io :as io]
ring.core.protocols)
(:import (clojure.lang IFn AFn)
(java.io ByteArrayOutputStream ByteArrayInputStream InputStreamReader BufferedReader InputStream Writer)))
(extend StreamableResponse
io/IOFactory
(assoc io/default-streams-impl
:make-input-stream (fn [^StreamableResponse this _]
(with-open [out (ByteArrayOutputStream. 4096)]
((.f this) out)
(ByteArrayInputStream.
(.toByteArray out))))
:make-reader (fn [^StreamableResponse this _]
(with-open [out (ByteArrayOutputStream. 4096)]
((.f this) out)
(BufferedReader.
(InputStreamReader.
(ByteArrayInputStream.
(.toByteArray out))))))))
zcaudate/foundation-base
(ns std.fs.interop
(:require [clojure.java.io]
[std.fs.path :as path])
(:import (java.nio.file Path)))
(extend Path
clojure.java.io/IOFactory
(assoc clojure.java.io/default-streams-impl
:make-input-stream (fn [path opts] (path/input-stream path))
:make-output-stream (fn [path opts] (path/output-stream path))))