Table of contents

DirectoryFetcher

The DirectoryFetcher class is a utility class that retrieves a list of files from a specified directory based on certain criteria. It inherits the ProactiveImageSourceAdapter class so that you can set it as the input of CaptureVisionRouter with the API setInput.

Definition

Namespace: com.dynamsoft.utility

Assembly: DynamsoftUtility.aar

class DirectoryFetcher extends ProactiveImageSourceAdapter

Methods

Method Description
setDirectory Sets the directory path and filter for the file search.
setPages Set the pages to read.
DirectoryFetcher The constructor.

The following methods are inherited from ProactiveImageSourceAdapter.

Method Description
setImageFetchInterval Sets the time interval for the ImageSource to wait before attempting to fetch another image to put in the buffer.
getImageFetchInterval Gets the time interval for the ImageSource to wait before attempting to fetch another image to put in the buffer.

The following methods are inherited from ImageSourceAdapter.

Method Description
addImageToBuffer Adds an image to the internal buffer.
clearBuffer Clears all images from the buffer, resetting the state for new image fetching.
getBufferOverflowProtectionMode Get the current mode for handling buffer overflow.
getColourChannelUsageType Get the current usage type for color channels in images.
getImageCount Get the current number of images in the buffer.
getImage Get a buffered image. Implementing classes should return a Promise that resolves with an instance of DSImageData.
getMaxImageCount Get the maximum number of images that can be buffered.
hasImage Checks if an image with the specified ID is present in the buffer.
hasNextImageToFetch Determines whether there are more images available to fetch.
isBufferEmpty Determines whether the buffer is currently empty.
setBufferOverflowProtectionMode Sets the behavior for handling new incoming images when the buffer is full.
setColourChannelUsageType Sets the usage type for color channels in images.
setErrorListener Sets an error listener to receive notifications about errors that occur during image source operations.
setMaxImageCount Sets the maximum number of images that can be buffered at any time.
setNextImageToReturn(imageId) Sets the processing priority of a specific image. This can affect the order in which images are returned by getImage.
setNextImageToReturn(imageId,keepInBuffer) Sets the processing priority of a specific image. This can affect the order in which images are returned by getImage.
startFetching Start fetching images from the source to the Video Buffer of ImageSourceAdapter.
stopFetching Stop fetching images from the source to the Video Buffer of ImageSourceAdapter.

setDirectory

Sets the directory path and filter for the file search.

void setDirectory(String directoryPath, String filter, boolean recursive) throws UtilityException;

Parameters

[in] directoryPath: The directory path.

[in] filter: A string that specifies file extensions. It determines which kinds of files to read. e.g “*.BMP;*.JPG;*.GIF”.

[in] recursive: Specifies whether to load files recursively.

Exception

Error Code Value Description
EC_READ_DIRECTORY_FAILED -10064 Failed to read the directory.

setPages

Set the pages to read.

void setPages(int[] pages) throws UtilityException;

Parameters

pages: An array that contains all the pages to read.

Exception

Error Code Value Description
EC_FILE_NOT_FOUND -10005 File not found.
EC_FILE_TYPE_NOT_SUPPORTED -10006 The file type is not supported.
EC_IMAGE_READ_FAILED -10012 Failed to read the image.

DirectoryFetcher

The constructor.

DirectoryFetcher()

Inherited Methods

The following methods are inherited from the ImageSourceAdapter class:

Method Description
hasNextImageToFetch Determines whether there are more images left to fetch.
setMaxImageCount Set the maximum capability of the Video Buffer.
getMaxImageCount Get the property defines the maximum capability of the Video Buffer.
setBufferOverflowProtectionMode Sets a mode that determines the action to take when there is a new incoming image and the buffer is full. You can either block the Video Buffer or push out the oldest image and append a new one.
getBufferOverflowProtectionMode Get the buffer overflow protection mode.
getImageCount Get the current image count in the Video Buffer.
isBufferEmpty Check whether the Video Buffer is empty.
setColourChannelUsageType Set the usage type of a color channel in an image.
getColourChannelUsageType Get the usage type of a color channel in an image.
startFetching Start fetching images from the source to the Video Buffer of ImageSourceAdapter.
stopFetching Stop fetching images from the source to the Video Buffer of ImageSourceAdapter.
getImage Get an image from the Video Buffer.
setNextImageToReturn(imageId) Specify the next image that is returned by method getImage.
setNextImageToReturn(imageId,keepInBuffer) Specify the next image that is returned by method getImage.
hasImage Check the availability of the specified image.
addImageToBuffer Adds an image to the buffer of the adapter.
clearBuffer Clears the image buffer.
setErrorListener Clears the image buffer.

This page is compatible for:

Is this page helpful?

YesYes NoNo

In this article: