public static class ContentStreamBase.URLStream extends ContentStreamBase
ContentStream from a URL
This uses a URLConnection to get the content streamURLConnectionContentStreamBase.FileStream, ContentStreamBase.StringStream, ContentStreamBase.URLStream| Modifier and Type | Field and Description |
|---|---|
private java.net.URL |
url |
contentType, DEFAULT_CHARSET, name, size, sourceInfo| Constructor and Description |
|---|
URLStream(java.net.URL url) |
| Modifier and Type | Method and Description |
|---|---|
java.io.InputStream |
getStream()
Get an open stream.
|
getCharsetFromContentType, getContentType, getName, getReader, getSize, getSourceInfo, setContentType, setName, setSize, setSourceInfopublic URLStream(java.net.URL url)
throws java.io.IOException
java.io.IOExceptionpublic java.io.InputStream getStream()
throws java.io.IOException
ContentStream
InputStream stream = stream.getStream();
try {
// use the stream...
}
finally {
IOUtils.closeQuietly(stream);
}
Only the first call to getStream() or getReader()
is guaranteed to work. The runtime behavior for additional calls is undefined.
Note: you must call getStream() or getReader() before
the attributes (name, contentType, etc) are guaranteed to be set. Streams may be
lazy loaded only when this method is called.java.io.IOException