There are a few factory methods in Google Guava to create InputSuppliers, e.g. from a byte[]
:
ByteStreams.newInputStreamSupplier(bytes);
No, I haven't seen anything.
I think you have found the best way.
The only alternative where to store the inputstream in a byte array or a file and create a Supplier with ByteStreams.newInputStreamSupplier() or Files.newInputStreamSupplier(), but I would discourage to do like that.
You could also use
public static long copy(InputStream from, OutputStream to)
from ByteStreams
see:src