Back to Fresco

ImageFormatChecker

docs/javadoc/reference/com/facebook/imageformat/ImageFormatChecker.html

3.6.013.3 KB
Original Source

Fresco

|

|

Packages | Classes

Interfaces

Classes

Packages | Classes

Summary: Methods | Inherited Methods | [Expand All]

public class

ImageFormatChecker

extends Object

| java.lang.Object | | ↳ | com.facebook.imageformat.ImageFormatChecker |

Class Overview

Detects the format of an encoded image.

Summary

Public Methods
ImageFormat
static ImageFormat
Tries to read up to MAX_HEADER_LENGTH bytes from InputStream is and use read bytes to determine type of the image contained in is.
static ImageFormat
Reads image header from a file indicated by provided filename and determines its format.
static ImageFormat
synchronized static ImageFormatChecker
Get the currently used instance of the image format checker
void

| [Expand] Inherited Methods | | --- | | From class java.lang.Object

| Object | clone() | | boolean | equals(Object arg0) | | void | finalize() | | final Class<?> | getClass() | | int | hashCode() | | final void | notify() | | final void | notifyAll() | | String | toString() | | final void | wait(long arg0, int arg1) | | final void | wait(long arg0) | | final void | wait() |

|

Public Methods

public ImageFormat determineImageFormat(InputStream is)

Throws

| IOException | |

public static ImageFormat getImageFormat(InputStream is)

Tries to read up to MAX_HEADER_LENGTH bytes from InputStream is and use read bytes to determine type of the image contained in is. If provided input stream does not support mark, then this method consumes data from is and it is not safe to read further bytes from is after this method returns. Otherwise, if mark is supported, it will be used to preserve original content of is.

Returns
  • ImageFormat matching content of is InputStream or UNKNOWN if no type is suitable
Throws

| IOException | if exception happens during read |

public static ImageFormat getImageFormat(String filename)

Reads image header from a file indicated by provided filename and determines its format. This method does not throw IOException if one occurs. In this case, UNKNOWN will be returned.

Returns
  • ImageFormat for image stored in filename

public static ImageFormat getImageFormat_WrapIOException(InputStream is)

public static synchronized ImageFormatChecker getInstance()

Get the currently used instance of the image format checker

Returns
  • the image format checker to use

public void setCustomImageFormatCheckers(List<ImageFormat.FormatChecker> customImageFormatCheckers)

+Generated by Doclava. +