Housekeeping for 0a35b8c
This commit is contained in:
parent
3f9fe327e0
commit
e403c17417
1 changed files with 15 additions and 13 deletions
|
|
@ -161,15 +161,17 @@
|
||||||
|
|
||||||
(defmacro write-id [out id] `(.writeByte ~out ~id))
|
(defmacro write-id [out id] `(.writeByte ~out ~id))
|
||||||
(defmacro write-bytes [out ba & [small?]]
|
(defmacro write-bytes [out ba & [small?]]
|
||||||
(let [out (with-meta out {:tag 'java.io.DataOutput})
|
(let [out (with-meta out {:tag 'java.io.DataOutput})
|
||||||
ba (with-meta ba {:tag 'bytes})
|
ba (with-meta ba {:tag 'bytes})]
|
||||||
;; Optimization, must be known before id's written
|
(if small? ; Optimization, must be known before id's written
|
||||||
;; `byte` to throw on range error
|
`(let [out# ~out, ba# ~ba
|
||||||
[wc wr] (if small? [byte 'writeByte] [int 'writeInt])]
|
size# (alength ba#)]
|
||||||
`(let [out# ~out, ba# ~ba
|
(.writeByte out# (byte size#))
|
||||||
size# (alength ba#)]
|
(.write out# ba# 0 size#))
|
||||||
(. out# ~wr (~wc size#))
|
`(let [out# ~out, ba# ~ba
|
||||||
(.write out# ba# 0 size#))))
|
size# (alength ba#)]
|
||||||
|
(.writeInt out# (int size#))
|
||||||
|
(.write out# ba# 0 size#)))))
|
||||||
|
|
||||||
(defmacro write-biginteger [out x]
|
(defmacro write-biginteger [out x]
|
||||||
(let [x (with-meta x {:tag 'java.math.BigInteger})]
|
(let [x (with-meta x {:tag 'java.math.BigInteger})]
|
||||||
|
|
@ -423,8 +425,8 @@
|
||||||
compressor ; Assume compressor
|
compressor ; Assume compressor
|
||||||
))
|
))
|
||||||
|
|
||||||
ba (if compressor (compress compressor ba) ba)
|
ba (if compressor (compress compressor ba) ba)
|
||||||
ba (if encryptor (encrypt encryptor password ba) ba)]
|
ba (if encryptor (encrypt encryptor password ba) ba)]
|
||||||
|
|
||||||
(if skip-header? ba
|
(if skip-header? ba
|
||||||
(wrap-header ba
|
(wrap-header ba
|
||||||
|
|
@ -665,8 +667,8 @@
|
||||||
|
|
||||||
(try
|
(try
|
||||||
(let [ba data-ba
|
(let [ba data-ba
|
||||||
ba (if encryptor (decrypt encryptor password ba) ba)
|
ba (if encryptor (decrypt encryptor password ba) ba)
|
||||||
ba (if compressor (decompress compressor ba) ba)
|
ba (if compressor (decompress compressor ba) ba)
|
||||||
dis (DataInputStream. (ByteArrayInputStream. ba))]
|
dis (DataInputStream. (ByteArrayInputStream. ba))]
|
||||||
(thaw-from-in! dis))
|
(thaw-from-in! dis))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue