Class PetPhotoParser


public class PetPhotoParser extends InputStreamParser
Parses image/png/image/jpeg/image/jpg byte streams into BufferedImage pet photos.

Petstore-local port of the deleted juneau-examples-rest image demo, relocated here (rather than juneau-examples-core) so juneau-petstore-core stays free of any dependency on the examples modules. Wired into PetStoreResource.putPetPhoto(long, BufferedImage).

See Also:
  • Constructor Details

    • PetPhotoParser

      public PetPhotoParser()
      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.