All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sksamuel.scrimage.ImageParseException Maven / Gradle / Ivy

There is a newer version: 4.2.0
Show newest version
package com.sksamuel.scrimage;

import com.sksamuel.scrimage.format.Format;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

public class ImageParseException extends IOException {

   private final List errors;

   public ImageParseException() {
      errors = new ArrayList<>();
   }

   public ImageParseException(List errors) {
      super("Image parsing failed for unknown image format. Tried the following ImageReader implementations:\n" + errors.stream().map(Throwable::getMessage).collect(Collectors.joining("\n")));
      this.errors = errors;
   }

   public ImageParseException(List errors, Format format) {
      super("Image parsing failed for " + format + ". If the format is `webp` ensure you have a webp reader on your classpath, such as the `scrimage-webp` module. Tried the following ImageReader implementations:\n" + errors.stream().map(Throwable::getMessage).collect(Collectors.joining("\n")));
      this.errors = errors;
   }

   public List getErrors() {
      return errors;
   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy