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 limit
IResourceRetriever instance
public InputStream getInputStreamByUrl(URL url) throws IOException
getInputStreamByUrl in interface IResourceRetriever
url - the source URL
IOException - if any input/output issue occurs
public byte[] getByteArrayByUrl(URL url) throws IOException
getByteArrayByUrl in interface IResourceRetriever
url - the source URL
IOException - if any input/output issue occurs
protected boolean urlFilter(URL url)
url - the source URL
Copyright © 1998–2022 iText Group NV. All rights reserved.