Replies: 5 comments
-
Seems sane. Pull request? |
Beta Was this translation helpful? Give feedback.
-
OK I hacked together the bits of it that I do know how to do, but there is a missing piece. The method taking an InputStream reuses org.apache.http.entity.InputStreamEntity. Obviously I have to make an alternative version of this which accepts WriteLogic, which would be vaguely like this:
It seems one way or another, an HttpEntity has to have a method returning InputStream. It isn't clear from their Javadoc what I'm supposed to do in this situation. isStreaming() is also questionable. They give an incomplete list of examples:
Of which my implementation is none of the above. I think I'm going to submit a ticket to them to improve the Javadoc and/or the interface... |
Beta Was this translation helpful? Give feedback.
-
Because I forgot to mention the issue in the commit, pull request #194 adds this. |
Beta Was this translation helpful? Give feedback.
-
Perhaps of interest, I was eventually forced to stop doing it this way with Sardine, reason being that some implementations of the WriteLogic interface took a long time before they sent any data, but Sardine opens the connection immediately because it doesn't know either - end result is the server sometimes kicked you off if it thought your connection had stalled. So now we write to a temp file and send it up using |
Beta Was this translation helpful? Give feedback.
-
Many APIs don't give back an
InputStream
for streaming serialisation, but instead ask me to pass anOutputStream
. For instance, [GSON.toJson](https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/Gson.html#toJson%28java.lang.Object, java.lang.Appendable%29) does this, GZIPOutputStream does as well, but all the custom filesystem APIs we use at work do the same thing, because it's more flexible.So I would like an overload to
put
where I can either do this:or this:
My workaround for the lack of it will be to create a Pipe and spin up an additional thread to do the copy, which is a little awkward.
Beta Was this translation helpful? Give feedback.
All reactions