tsuraan a écrit : > I was given a class java.lang.String > Chars are [\h \i \space \t \h \e \r \e] > Given string is 'hi there' > Bytes length is 8 > OtpBinary size is 35 > > with [ inside (str s) ] > > I was given a class java.lang.String > Chars are [\h \i \space \t \h \e \r \e] > Given string is 'hi there' > Bytes length is 8 > OtpBinary size is 8 > > So, I'm hoping this gives somebody an idea, because I'm stumped. >
I guess that if you enable reflection warnings, you'll get a warning on the line where you invoke the constructor. I think the reflective dispatch doesn't pick the good constructor and invokes OtpErlangBitstr(Object) instead of OtpErlangBitstr(byte[]). Thus your byte[] is serialized and the 35 above is the length of the serialized array. A type hint on s should fix the issue: (defmethod to-otp String [ #^String s ] (OtpErlangBinary. (.getBytes s "utf-8"))) hth Christophe -- Professional: http://cgrand.net/ (fr) On Clojure: http://clj-me.blogspot.com/ (en) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---