com.asprise.imaging.scan

## Class AbstractScanListener

- java.lang.Object
- - com.asprise.imaging.scan.AbstractScanListener

- All Implemented Interfaces:
    ScanListener

      public abstract class AbstractScanListener
      extends Object
      implements ScanListener

  Default implementation without ScanListener.getPageOutputTarget(int, long). For single page scanning, you can pass in a ScanProgressListener to be notified on events.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractScanListener()`
    `AbstractScanListener(ScanProgressListener progressListener)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `finished(String error)` Scanning session has finished
    `List<Capability>` | `getCapabilitiesToBeSet(int pageIndex, long pageId)` List of capabilities to be set for the given page - in most cases, you should only set capabilities for the first page.
    `static AbstractScanListener` | `newScanListener(OutputStream outputStream, ScanProgressListener progressListener)` Constructs a scan listener with ScanListener.getPageOutputTarget(int, long) returns the same output stream for any page.
    `static AbstractScanListener` | `newScanListener(String targetFilePath, ScanProgressListener progressListener)` Constructs a scan listener with ScanListener.getPageOutputTarget(int, long) returns the same file path for any page.
    `void` | `pageFinished(int pageIndex, long pageId, String error)` Indicates a page scan is done.
    `void` | `pageProgress(int pageIndex, long pageId, int percent)` Reports the progress of page scanning.
    `void` | `pageStarted(int pageIndex, long pageId)` Indicates a page scan in this session has been started.
    `void` | `started()` Scanning session has started; an ADF session could result multiple pages scanned.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface com.asprise.imaging.scan.ScanListener

      `getPageOutputTarget`

- - ### Constructor Detail

    - #### AbstractScanListener

          public AbstractScanListener(ScanProgressListener progressListener)

    - #### AbstractScanListener

          public AbstractScanListener()

  - ### Method Detail

    - #### newScanListener

          public static AbstractScanListener newScanListener(String targetFilePath,
                                             ScanProgressListener progressListener)

      Constructs a scan listener with ScanListener.getPageOutputTarget(int, long) returns the same file path for any page.
      Parameters:
        `targetFilePath` -
        `progressListener` - optional progress listener
      Returns:

    - #### newScanListener

          public static AbstractScanListener newScanListener(OutputStream outputStream,
                                             ScanProgressListener progressListener)

      Constructs a scan listener with ScanListener.getPageOutputTarget(int, long) returns the same output stream for any page.
      Parameters:
        `outputStream` -
        `progressListener` - optional progress listener
      Returns:

    - #### getCapabilitiesToBeSet

          public List<Capability> getCapabilitiesToBeSet(int pageIndex,
                                                long pageId)

      Description copied from interface: `ScanListener`
      List of capabilities to be set for the given page - in most cases, you should only set capabilities for the first page.
      Specified by:
        `getCapabilitiesToBeSet` in interface `ScanListener`
      Returns:

    - #### started

          public void started()

      Description copied from interface: `ScanListener`
      Scanning session has started; an ADF session could result multiple pages scanned.
      Specified by:
        `started` in interface `ScanListener`

    - #### pageStarted

          public void pageStarted(int pageIndex,
                         long pageId)

      Description copied from interface: `ScanListener`
      Indicates a page scan in this session has been started.
      Specified by:
        `pageStarted` in interface `ScanListener`

    - #### pageProgress

          public void pageProgress(int pageIndex,
                          long pageId,
                          int percent)

      Description copied from interface: `ScanListener`
      Reports the progress of page scanning.
      Specified by:
        `pageProgress` in interface `ScanListener`
        `percent` - a number between 0 to 100.

    - #### pageFinished

          public void pageFinished(int pageIndex,
                          long pageId,
                          String error)

      Description copied from interface: `ScanListener`
      Indicates a page scan is done.
      Specified by:
        `pageFinished` in interface `ScanListener`
        `error` - error message or `null` if succeeded.

    - #### finished

          public void finished(String error)

      Description copied from interface: `ScanListener`
      Scanning session has finished
      Specified by:
        `finished` in interface `ScanListener`
      Parameters:
        `error` - error message or `null` if succeeded.

Copyright © Asprise Software. All Rights Reserved. Please visit the product page at asprise.com