Resource Base
Table of contents

Thanks for downloading Dynamsoft Barcode Reader Package!

Your download will start shortly. If your download does not begin, click here to retry.

DSDirectoryFetcher

The DSDirectoryFetcher class is a utility class that retrieves a list of files from a specified directory based on certain criteria. It inherits from the DSImageSourceAdapter class.

Definition

Assembly: DynamsoftUtility.framework

  • Objective-C
  • Swift
  1. NS_SWIFT_NAME(DirectoryFetcher)
    @interface DSDirectoryFetcher : DSImageSourceAdapter
    
  2. class DirectoryFetcher : ImageSourceAdapter
    

Methods

Method Description
init Create an instance of DSDirectoryFetcher.
setDirectory Sets the directory path and filter for the file search.
setPages Set the pages to read.

init

Create an instance of DSDirectoryFetcher.

  • Objective-C
  • Swift
  1. - (instancetype)init;
    
  2. init()
    

Return Value

An instance of DSDirectoryFetcher.

Code Snippet

  • Objective-C
  • Swift
  1. DSDirectoryFetcher *fetcher = [[DSDirectoryFetcher alloc] init];
    
  2. let fetcher = DirectoryFetcher()
    

setDirectory

Sets the directory path and filter for the file search.

  • Objective-C
  • Swift
  1. - (BOOL)setDirectory:(NSString *)directoryPath
                filter:(nullable NSString *)filter
                recursive:(BOOL)recursive
                error:(NSError * _Nullable * _Nullable)error;
    
  2. func setDirectory(_ directoryPath: String, filter: String?, recursive: Bool) throws
    

Parameters

directoryPath: The directory path.

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

recursive: Specifies whether to load files recursively.

error: An NSError pointer. If an error occurs, it will represent the error information.

Error

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

Return Value

A BOOL value that indicates whether the directory is set successfully.

Code Snippet

  • Objective-C
  • Swift
  1. NSError *error;
    BOOL success = [fetcher setDirectory:directoryPath filter:nil recursive:YES error:&error];
    
  2. do {
       try fetcher.setDirectory(directoryPath, filter: nil, recursive: true)
    } catch {
       // Add your code to deal with exceptions.
    }
    

setPages

Set the pages to read.

  • Objective-C
  • Swift
  1. -(BOOL)setPages:(NSArray *)pages
          error:(NSError *_Nullable *_Nullable)error;
    
  2. func setPages(_ pages: NSArray) throws -> BOOL
    

Parameters

pages: An array that contains all the pages to read.
error: An NSError pointer. If an error occurs, it will represent the error information.

Error

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.

This page is compatible for:

Version 1.0

Is this page helpful?

YesYes NoNo

In this article:

latest version

  • Latest version
  • Version 2.x
    • Version 2.2.10
    • Version 2.0.21
    • Version 2.0.20
    • Version 2.0.10
    • Version 2.2.10
    • Version 2.0.21
    • Version 2.0.20
    • Version 2.0.10
  • Version 1.x
    • Version 1.2.1
    • Version 1.2.0
    • Version 1.1.0
    • Version 1.0.0
    • Version 1.0.4
    • Version 1.0.3
    • Version 1.0.2
    • Version 1.0.1
    • Version 1.0.0
    • Version 1.1.11
    • Version 1.1.9
    • Version 1.1.8
    • Version 1.1.7
    • Version 1.1.6
    • Version 1.1.5
    • Version 1.1.4
    • Version 1.1.3
    • Version 1.1.2
    • Version 1.1.1
    • Version 1.1.0
    • Version 1.0.0
    • Version 1.0.4
    • Version 1.0.3
    • Version 1.0.2
    • Version 1.0.1
    • Version 1.0.0
Change +
© 2003–2024 Dynamsoft. All rights reserved.
Privacy Statement / Site Map / Home / Purchase / Support