Closed talklittle closed 9 years ago
The reason I didn't include every option is because I'd like to keep my options open for switching to another JSON parsing backend if something better comes along down the road (of if I write my own, which I've been toying with the idea of). Jackson core is definitely the fastest available at the moment, but I'm sure there's room for improvement, especially if it's written with mobile in mind (which Jackson was not).
While I'm sure any future library will include support for Stream
s and String
s, I'm not totally sure they'll include support for URL
s, Reader
s, etc. To me, adding support for the byte[]
and char[]
parameters seem reasonable, as I can't imagine another library not including support for those.
I'm not comfortable adding URL
support, since it seems like adding that option would just encourage people to not use a proper networking library. No idea what Jackson uses internally, but I very much doubt it's in any way optimized for Android.
File
objects can easily be passed in as Stream
s, so I'm not too concerned with that one. Do you know of any networking libraries that use Reader
s? Is there something about them that would make wrapping the Reader
in a ReaderInputStream
bad?
Thanks for the answer. I think it is easy enough to work around this limitation using the appropriate InputStream
s like FileInputStream
as you've indicated. Good idea to keep the implementation flexible to different parser backends. I'll close this issue.
Reopening it to remind me to add byte[]
char[]
support :)
Thanks for all these ideas for enhancements, btw! It's been super helpful.
b5dbe848059a73bbf35bd1f40cb7693578b102c4
Would be nice to be able to
LoganSquare.parse()
from the different sources allowed by Jackson'sJsonFactory
.JsonFactory
provides all of the following:createParser(File)
createParser(URL)
createParser(InputStream)
createParser(Reader)
createParser(byte[])
createParser(byte[], int, int)
createParser(String)
createParser(char[])
createParser(char[], int, int)