com.aspose.ocr

## Class ImageStream

- java.lang.Object
- - com.aspose.ocr.ImageStream

-     public final class ImageStream
      extends Object

  This factory creates objects of `IImageStream` type. This has a set of static methods for creating objects from different input data.

  >      OcrEngine ocr = new OcrEngine();
  >      ocr.setImage(ImageStream.fromFile("image.tiff"));
  >      ocr.setImage(ImageStream.fromBytes(bytes, imageStreamFormat));

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static IImageStream` | `fromBytes(byte[] bytes, ImageStreamFormat type)` Creates instance of `IImageStream` object from bytes array, parameter "format" sets a data type.
    `static IImageStream` | `fromFile(String imageFile)` Creates instance of “IImageStream” from the specified file.

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

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

- - ### Method Detail

    - #### fromBytes

          public static IImageStream fromBytes(byte[] bytes,
                               ImageStreamFormat type)

      Creates instance of `IImageStream` object from bytes array, parameter "format" sets a data type.

      Parameters:
        `bytes` - The bytes array with image data.
        `type` - The `ImageStreamFormat` object sets image format in bytes parameter.
      Returns:
        The instance of `IImageStream`.

    - #### fromFile

          public static IImageStream fromFile(String imageFile)

      Creates instance of “IImageStream” from the specified file. This will raise exception if the file not exists or the file formats is not supported.

      Parameters:
        `imageFile` - A string that contains the name of the file from which to create the `IImageStream`.
      Returns:
        The `IImageStream` object.
      Throws:
        `OcrException` - Thrown when file not exists or format not supported.

Copyright © 2014. All rights reserved.