-
public class ImageFormatCheckerDetects the format of an encoded image.
-
-
Method Summary
Modifier and Type Method Description voidsetUseNewOrder(boolean useNewOrder)voidsetCustomImageFormatCheckers(@Nullable() List<ImageFormat.FormatChecker> customImageFormatCheckers)ImageFormatdetermineImageFormat(InputStream is)static synchronized ImageFormatCheckergetInstance()Get the currently used instance of the image format checker static ImageFormatgetImageFormat(InputStream is)Tries to read up to MAX_HEADER_LENGTH bytes from InputStream is and use read bytes to determinetype of the image contained in is. static ImageFormatgetImageFormat_WrapIOException(InputStream is)static ImageFormatgetImageFormat(String filename)Reads image header from a file indicated by provided filename and determines its format. -
-
Method Detail
-
setUseNewOrder
void setUseNewOrder(boolean useNewOrder)
-
setCustomImageFormatCheckers
void setCustomImageFormatCheckers(@Nullable() List<ImageFormat.FormatChecker> customImageFormatCheckers)
-
determineImageFormat
ImageFormat determineImageFormat(InputStream is)
-
getInstance
static synchronized ImageFormatChecker getInstance()
Get the currently used instance of the image format checker
-
getImageFormat
static ImageFormat getImageFormat(InputStream is)
Tries to read up to MAX_HEADER_LENGTH bytes from InputStream is and use read bytes to determinetype of the image contained in is. If provided input stream does not support mark, then thismethod consumes data from is and it is not safe to read further bytes from is after this methodreturns. Otherwise, if mark is supported, it will be used to preserve original content of is.
-
getImageFormat_WrapIOException
static ImageFormat getImageFormat_WrapIOException(InputStream is)
-
getImageFormat
static ImageFormat getImageFormat(String filename)
Reads image header from a file indicated by provided filename and determines its format. Thismethod does not throw IOException if one occurs. In this case, UNKNOWN willbe returned.
-
-
-
-