Java 如何找到Clojure函数(spit)允许的选项?
Clojure函数Java 如何找到Clojure函数(spit)允许的选项?,java,clojure,documentation,Java,Clojure,Documentation,Clojure函数spit允许将数据写入文件,例如: (spit "filename.txt" "content") 它还允许向现有文件添加内容 (spit "filename.txt" "content" :append true) 在文档((doc spit))中,它只说明可以将选项传递给clojure.java.io/writer。但是(doc clojure.java.io/writer)没有列出允许的选项。那么,是否有可用文档的“详细模式” 我通过找到了:append-选项,但我确
spit
允许将数据写入文件,例如:
(spit "filename.txt" "content")
它还允许向现有文件添加内容
(spit "filename.txt" "content" :append true)
在文档((doc spit)
)中,它只说明可以将选项传递给clojure.java.io/writer
。但是(doc clojure.java.io/writer)
没有列出允许的选项。那么,是否有可用文档的“详细模式”
我通过找到了
:append
-选项,但我确信它也列在文档中的某个地方。可能大多数选项都是从Java底层库映射的
通过浏览源代码,我确认:编码合法
由于Java不是我最常用的语言,我不能再帮上忙了,希望它能通过clojure.Java.io/writer
帮助生成writer
,因此在中找到它
@爱德华,只有:append
和:encoding
@Jaime Agudo的答案是正确的,我没有看到他的答案:-(.检查。
Common options include
:append true to open stream in append mode
:encoding string name of encoding to use, e.g. \"UTF-8\".
(defprotocol ^{:added "1.2"} IOFactory
"Factory functions that create ready-to-use, buffered versions of
the various Java I/O stream types, on top of anything that can
be unequivocally converted to the requested kind of stream.
Common options include
:append true to open stream in append mode
:encoding string name of encoding to use, e.g. \"UTF-8\".
Callers should generally prefer the higher level API provided by
reader, writer, input-stream, and output-stream."
(^{:added "1.2"} make-reader [x opts] "Creates a BufferedReader. See also IOFactory docs.")
(^{:added "1.2"} make-writer [x opts] "Creates a BufferedWriter. See also IOFactory docs.")
(^{:added "1.2"} make-input-stream [x opts] "Creates a BufferedInputStream. See also IOFactory docs.")
(^{:added "1.2"} make-output-stream [x opts] "Creates a BufferedOutputStream. See also IOFactory docs."))