[#103] add .write and .append support for BufferedWriter

This commit is contained in:
Michiel Borkent 2019-11-16 11:01:27 +01:00 committed by GitHub
parent 76a8e784c9
commit 8c5cc4ee67
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 0 deletions

View file

@ -17,6 +17,12 @@
"allPublicFields": true,
"allPublicConstructors": true
},
{
"name":"java.io.BufferedWriter",
"allPublicMethods":true,
"allPublicFields": true,
"allPublicConstructors": true
},
{
"name":"java.io.BufferedReader",
"allPublicMethods":true

View file

@ -216,6 +216,7 @@ Everything after that is bound to *command-line-args*."))
:classes {'java.lang.ArithmeticException ArithmeticException
'java.lang.AssertionError AssertionError
'java.lang.Boolean Boolean
'java.io.BufferedWriter java.io.BufferedWriter
'java.lang.Class Class
'java.lang.Double Double
'java.lang.Exception Exception

View file

@ -247,3 +247,13 @@
(bb nil "(vec (.split (java.util.regex.Pattern/compile \"f\") \"1f2f3\"))")))
(is (= java.util.regex.Pattern/CANON_EQ
(bb nil "java.util.regex.Pattern/CANON_EQ"))))
(deftest writer-test
(let [tmp-file (java.io.File/createTempFile "bbb" "bbb")
path (.getPath tmp-file)]
(bb nil (format "(with-open [w (io/writer \"%s\")]
(.write w \"foobar\n\")
(.append w \"barfoo\n\")
nil)"
path))
(is (= "foobar\nbarfoo\n" (slurp path)))))