Class ByteSizeCheck

java.lang.Object
org.apache.tika.imageprocessing.ByteSizeCheck
All Implemented Interfaces:
Serializable, ImageCheck

public class ByteSizeCheck extends Object implements ImageCheck
Refuses an image shorter than minBytes or longer than maxBytes, by its measured length: the image is not read, so this is the cheapest check to run first. A setting of 0 turns that limit off, and an image whose length is unknown or only declared is admitted. The reasons are file-too-small and file-too-large, as the VLM parsers' own byte limits report them; those limits stay, this one is for any engine.
Since:
Apache Tika 4.2
See Also:
  • Constructor Details

    • ByteSizeCheck

      public ByteSizeCheck()
  • Method Details

    • check

      public ImageCheck.Verdict check(ImageProbe image, Metadata metadata, ParseContext context) throws IOException
      Specified by:
      check in interface ImageCheck
      Parameters:
      image - the image and what earlier checks have already learned about it
      metadata - the metadata of the image the engine would be handed
      context - the parse context
      Throws:
      IOException
    • getMinBytes

      public long getMinBytes()
    • setMinBytes

      public void setMinBytes(long minBytes)
    • getMaxBytes

      public long getMaxBytes()
    • setMaxBytes

      public void setMaxBytes(long maxBytes)