Class ImageParser


public class ImageParser extends InputStreamParser
Example parser that converts byte streams to BufferedImage objects.
See Also:
  • Constructor Details

    • ImageParser

      public ImageParser()
      Constructor with default settings (consumes image/png, image/jpeg and image/jpg).
  • Method Details

    • doRead

      public <T> T doRead(ParserSession session, ParserPipe pipe, ClassMeta<T> type) throws IOException, ParseException
      Workhorse method.

      Subclasses are expected to either implement this method or ParserSession.doRead(ParserPipe, ClassMeta).

      Overrides:
      doRead in class Parser
      Type Parameters:
      T - The class type of the object to create.
      Parameters:
      session - The current session.
      pipe - Where to get the input from.
      type - The class type of the object to create. If null or Object.class, object type is based on what's being parsed. For example, when parsing JSON text, it may return a String, Number, JsonMap, etc...
      Returns:
      The parsed object.
      Throws:
      IOException - Thrown by underlying stream.
      ParseException - Malformed input encountered.