The input stream is guaranteed to be closed at the end of {@link #writeTo(OutputStream)}.
Sample use with a URL:
private static void setRequestJpegContent(HttpRequest request, URL jpegUrl) throws IOException { request.setContent(new InputStreamContent("image/jpeg", jpegUrl.openStream())); }
Implementation is not thread-safe.
@since 1.0 @author Yaniv Inbar
|
|