Write/reading java maps and lists using fressian/transit
Hi, I have a program I wrote who needs to serialize java HashMaps and ArrayLists to and from disk but AFAIK (and after some simple tests) it seems fressian writes those maps/lists correctly but read them back as clojure maps and lists (persistent). Is there a way to tell fressian (could be transit too) to read them back as java maps/lists? Just for some context, it's a huge amount of data and it should be serialized in binary format/non-human readable way for performance and space considerations. All the data is composed of simple types (maps, lists, strings, numbers, keywords only. No complex objects) I'm thinking about maybe just using some java serialization library if fressian/transit doesn't support that. Thanks in advance. -- 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 Note that posts from new members are moderated - please be patient with your first post. 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 --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Write/reading java maps and lists using fressian/transit
Both Transit and fressian take a Handler map as arguments to the reader/writer functions/constructors. So its pretty straightforward to replace the default handlers with handlers that do what you want. I have no example handy but it should be documented in both libraries. Transit has something called mapBuilder, not sure about fressian. HTH, /thomas On Thursday, August 7, 2014 2:48:20 PM UTC+2, Islon Scherer wrote: Hi, I have a program I wrote who needs to serialize java HashMaps and ArrayLists to and from disk but AFAIK (and after some simple tests) it seems fressian writes those maps/lists correctly but read them back as clojure maps and lists (persistent). Is there a way to tell fressian (could be transit too) to read them back as java maps/lists? Just for some context, it's a huge amount of data and it should be serialized in binary format/non-human readable way for performance and space considerations. All the data is composed of simple types (maps, lists, strings, numbers, keywords only. No complex objects) I'm thinking about maybe just using some java serialization library if fressian/transit doesn't support that. Thanks in advance. -- 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 Note that posts from new members are moderated - please be patient with your first post. 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 --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Write/reading java maps and lists using fressian/transit
Ok, I got it. Instead of using transit-clj I can user the java library directly. The reader automatically returns ArrayList and HashMap. Great! On Thursday, August 7, 2014 8:11:50 PM UTC+2, Thomas Heller wrote: Both Transit and fressian take a Handler map as arguments to the reader/writer functions/constructors. So its pretty straightforward to replace the default handlers with handlers that do what you want. I have no example handy but it should be documented in both libraries. Transit has something called mapBuilder, not sure about fressian. HTH, /thomas On Thursday, August 7, 2014 2:48:20 PM UTC+2, Islon Scherer wrote: Hi, I have a program I wrote who needs to serialize java HashMaps and ArrayLists to and from disk but AFAIK (and after some simple tests) it seems fressian writes those maps/lists correctly but read them back as clojure maps and lists (persistent). Is there a way to tell fressian (could be transit too) to read them back as java maps/lists? Just for some context, it's a huge amount of data and it should be serialized in binary format/non-human readable way for performance and space considerations. All the data is composed of simple types (maps, lists, strings, numbers, keywords only. No complex objects) I'm thinking about maybe just using some java serialization library if fressian/transit doesn't support that. Thanks in advance. -- 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 Note that posts from new members are moderated - please be patient with your first post. 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 --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.