Table of Contents

Class DefaultResourceRetriever

Namespace
iText.StyledXmlParser.Resolver.Resource
Assembly
itext.styledxmlparser.dll

Default implementation of the 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.

public class DefaultResourceRetriever : IResourceRetriever
Inheritance
DefaultResourceRetriever
Implements
Inherited Members

Constructors

DefaultResourceRetriever()

Creates a new DefaultResourceRetriever instance.

public DefaultResourceRetriever()

Remarks

Creates a new DefaultResourceRetriever instance. The limit on the size of retrieved resources is by default equal to MaxValue bytes.

Methods

GetByteArrayByUrl(Uri)

Gets the byte array that are retrieved from the source URL.

public virtual byte[] GetByteArrayByUrl(Uri url)

Parameters

url Uri

the source URL

Returns

byte[]

the byte array or null if the retrieving failed or the URL was filtered or the resourceSizeByteLimit was violated

GetInputStreamByUrl(Uri)

Gets the input stream with current limit on the number of bytes read, that connect with source URL for retrieving data from that connection.

public virtual Stream GetInputStreamByUrl(Uri url)

Parameters

url Uri

the source URL

Returns

Stream

the limited input stream or null if the URL was filtered

GetResourceSizeByteLimit()

Gets the resource size byte limit.

public virtual long GetResourceSizeByteLimit()

Returns

long

the resource size byte limit

Remarks

Gets the resource size byte limit. The resourceSizeByteLimit is used to create input stream with a limit on the number of bytes read.

SetResourceSizeByteLimit(long)

Sets the resource size byte limit.

public virtual IResourceRetriever SetResourceSizeByteLimit(long resourceSizeByteLimit)

Parameters

resourceSizeByteLimit long

the resource size byte limit

Returns

IResourceRetriever

the IResourceRetriever instance

Remarks

Sets the resource size byte limit. The resourceSizeByteLimit is used to create input stream with a limit on the number of bytes read.

UrlFilter(Uri)

Method for filtering resources by URL.

protected virtual bool UrlFilter(Uri url)

Parameters

url Uri

the source URL

Returns

bool

true if the resource can be retrieved and false otherwise

Remarks

Method for filtering resources by URL. The default implementation allows for all URLs. Override this method if want to set filtering.