Many APIs don't give back an InputStream for streaming serialisation, but instead ask me to pass an OutputStream. 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:
getSardine().put(childUri.toString(), stream -> {
// I write to stream
});
or this:
try (OutputStream stream = getSardine().put(childUri.toString())) {
// I write to stream
}
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.
Many APIs don't give back an
InputStreamfor 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
putwhere 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.