public class DefaultResourceRetriever extends Object implements IResourceRetriever
IResourceRetriever interface, which can set a limit
on the size of retrieved resources using input stream with a limit on the number of bytes read.| Constructor and Description |
|---|
DefaultResourceRetriever()
Creates a new
DefaultResourceRetriever instance. |
| Modifier and Type | Method and Description |
|---|---|
byte[] |
getByteArrayByUrl(URL url)
Gets the byte array that are retrieved from the source URL.
|
InputStream |
getInputStreamByUrl(URL url)
Gets the input stream with current limit on the number of bytes read,
that connect with source URL for retrieving data from that connection.
|
long |
getResourceSizeByteLimit()
Gets the resource size byte limit.
|
IResourceRetriever |
setResourceSizeByteLimit(long resourceSizeByteLimit)
Sets the resource size byte limit.
|
protected boolean |
urlFilter(URL url)
Method for filtering resources by URL.
|
public DefaultResourceRetriever()
DefaultResourceRetriever instance.
The limit on the size of retrieved resources is by default equal to Long.MAX_VALUE bytes.public long getResourceSizeByteLimit()
public IResourceRetriever setResourceSizeByteLimit(long resourceSizeByteLimit)
resourceSizeByteLimit - the resource size byte limitIResourceRetriever instancepublic InputStream getInputStreamByUrl(URL url) throws IOException
getInputStreamByUrl in interface IResourceRetrieverurl - the source URLIOException - if any input/output issue occurspublic byte[] getByteArrayByUrl(URL url) throws IOException
getByteArrayByUrl in interface IResourceRetrieverurl - the source URLIOException - if any input/output issue occursprotected boolean urlFilter(URL url)
url - the source URLCopyright © 1998–2021 iText Group NV. All rights reserved.