mirror of
https://github.com/penpot/penpot.git
synced 2025-03-20 19:51:23 -05:00
🐛 Fix issue on fressian blob encoding.
This commit is contained in:
parent
8e4338c1c9
commit
ff4d3cfeac
1 changed files with 29 additions and 7 deletions
|
@ -10,16 +10,18 @@
|
|||
[app.common.geom.point :as gpt]
|
||||
[clojure.data.fressian :as fres])
|
||||
(:import
|
||||
clojure.lang.Ratio
|
||||
org.fressian.handlers.WriteHandler
|
||||
org.fressian.handlers.ReadHandler
|
||||
org.fressian.Writer
|
||||
org.fressian.Reader
|
||||
org.fressian.StreamingWriter
|
||||
app.common.geom.matrix.Matrix
|
||||
app.common.geom.point.Point
|
||||
clojure.lang.Ratio
|
||||
java.io.ByteArrayInputStream
|
||||
java.io.ByteArrayOutputStream))
|
||||
java.io.ByteArrayOutputStream
|
||||
java.time.Instant
|
||||
java.time.OffsetDateTime
|
||||
org.fressian.Reader
|
||||
org.fressian.StreamingWriter
|
||||
org.fressian.Writer
|
||||
org.fressian.handlers.ReadHandler
|
||||
org.fressian.handlers.WriteHandler))
|
||||
|
||||
;; --- MISC
|
||||
|
||||
|
@ -92,6 +94,20 @@
|
|||
(.-e ^Matrix o)
|
||||
(.-f ^Matrix o)))))}
|
||||
|
||||
Instant
|
||||
{"java/instant"
|
||||
(reify WriteHandler
|
||||
(write [_ w ch]
|
||||
(.writeTag w "java/instant" 1)
|
||||
(.writeInt w (.toEpochMilli ^Instant ch))))}
|
||||
|
||||
OffsetDateTime
|
||||
{"java/instant"
|
||||
(reify WriteHandler
|
||||
(write [_ w ch]
|
||||
(.writeTag w "java/instant" 1)
|
||||
(.writeInt w (.toEpochMilli ^Instant (.toInstant ^OffsetDateTime ch)))))}
|
||||
|
||||
Ratio
|
||||
{"ratio"
|
||||
(reify WriteHandler
|
||||
|
@ -181,6 +197,12 @@
|
|||
(read [_ rdr _ _]
|
||||
(char (.readObject rdr))))
|
||||
|
||||
"java/instant"
|
||||
(reify ReadHandler
|
||||
(read [_ rdr _ _]
|
||||
(Instant/ofEpochMilli (.readInt rdr))))
|
||||
|
||||
|
||||
"clj/ratio"
|
||||
(reify ReadHandler
|
||||
(read [_ rdr _ _]
|
||||
|
|
Loading…
Add table
Reference in a new issue