Examples of MemoryCacheSeekableStream


Examples of com.lightcrafts.media.jai.codec.MemoryCacheSeekableStream

        InputStream stream = null;
        RenderedImage rendering = null;
        try {
            URL url = new URL(buf.toString());
            stream = url.openStream();
            MemoryCacheSeekableStream sStream =
                new MemoryCacheSeekableStream(stream);
            rendering = JAI.create(format, sStream);
        } catch(Exception e) {
            String message =
                JaiI18N.getString("IIPCRIF7") + " " + buf.toString();
            listener.errorOccurred(message,
View Full Code Here

Examples of com.sun.media.jai.codec.MemoryCacheSeekableStream

        InputStream stream = null;
        RenderedImage rendering = null;
        try {
            URL url = new URL(buf.toString());
            stream = url.openStream();
            MemoryCacheSeekableStream sStream =
                new MemoryCacheSeekableStream(stream);
            rendering = JAI.create(format, sStream);
        } catch(Exception e) {
            String message =
                JaiI18N.getString("IIPCRIF7") + " " + buf.toString();
            listener.errorOccurred(message,
View Full Code Here

Examples of com.sun.media.jai.codec.MemoryCacheSeekableStream

/*  792 */     InputStream stream = null;
/*  793 */     RenderedImage rendering = null;
/*      */     try {
/*  795 */       URL url = new URL(buf.toString());
/*  796 */       stream = url.openStream();
/*  797 */       MemoryCacheSeekableStream sStream = new MemoryCacheSeekableStream(stream);
/*      */
/*  799 */       rendering = JAI.create(format, sStream);
/*      */     } catch (Exception e) {
/*  801 */       String message = JaiI18N.getString("IIPCRIF7") + " " + buf.toString();
/*      */
View Full Code Here

Examples of com.sun.media.jai.codec.MemoryCacheSeekableStream

                }
                // commonly supported with this
                // mime type, even though it's not
                // an IANA-registered image type
                return JAI.create("stream",
                                  new MemoryCacheSeekableStream(response
                                          .getEntity().getContent()))
                        .getAsBufferedImage();
            } else {
                throw new ServletException("Source image was not a gif, png, "
                        + "bmp, tiff, or jpg.");
View Full Code Here

Examples of com.sun.media.jai.codec.MemoryCacheSeekableStream

    public void setContent(InputStream data) throws IOException {
        try {
            ImageIcon image =
                    new ImageIcon(JAI
                            .create("stream",
                                    new MemoryCacheSeekableStream(data))
                            .getAsBufferedImage());
            if (m_pane == null) {
                m_label = new JLabel(image);
                m_pane = new JScrollPane(m_label);
            } else {
View Full Code Here

Examples of com.sun.media.jai.codec.MemoryCacheSeekableStream

          float scale = ImageStyleUtils.getScale(originalWidth, originalHeight, imageStyle);
          int scaledWidth = (int) Math.round(originalWidth * scale) - (int) ImageStyleUtils.getCropX(Math.round(originalWidth * scale), Math.round(originalHeight * scale), imageStyle);
          int scaledHeight = (int) Math.round(originalHeight * scale) - (int) ImageStyleUtils.getCropY(Math.round(originalWidth * scale), Math.round(originalHeight * scale), imageStyle);

          // Load the image from the given input stream
          seekableInputStream = new MemoryCacheSeekableStream(response.getEntity().getContent());
          RenderedOp image = JAI.create("stream", seekableInputStream);
          if (image == null)
            throw new IOException("Error reading image from input stream");

          // Get the original image size
View Full Code Here

Examples of com.sun.media.jai.codec.MemoryCacheSeekableStream

          float scale = ImageStyleUtils.getScale(originalWidth, originalHeight, style);
          int scaledWidth = (int) Math.round(originalWidth * scale) - (int) ImageStyleUtils.getCropX(Math.round(originalWidth * scale), Math.round(originalHeight * scale), style);
          int scaledHeight = (int) Math.round(originalHeight * scale) - (int) ImageStyleUtils.getCropY(Math.round(originalWidth * scale), Math.round(originalHeight * scale), style);

          // Load the image from the given input stream
          seekableInputStream = new MemoryCacheSeekableStream(response.getEntity().getContent());
          RenderedOp image = JAI.create("stream", seekableInputStream);
          if (image == null)
            throw new IOException("Error reading image from input stream");

          // Get the actual image size
View Full Code Here

Examples of com.sun.media.jai.codec.MemoryCacheSeekableStream

    content.setCreator(user);

    // Set the creation date
    content.setCreationDate(new Date());

    MemoryCacheSeekableStream mcss = new MemoryCacheSeekableStream(is);
    UnclosableInputStream bis = new UnclosableInputStream(mcss);

    // Read the Exif metadata (if available)
    try {
      readExifMetadata(content, bis);
    } catch (Throwable t) {
      logger.warn("Error extracting Exif metadata from {}: {}", fileName, t.getMessage());
    }

    // Read the JAI metadata
    if (content.getWidth() <= 0 || content.getHeight() <= 0) {
      try {
        mcss.seek(0);
        readJAIMetadata(content, mcss);
      } catch (Throwable t) {
        logger.warn("Error extracting metadata using java advanced imaging (jai) from {}: {}", fileName, t.getMessage());
        throw new IOException(t);
      } finally {
View Full Code Here

Examples of com.sun.media.jai.codec.MemoryCacheSeekableStream

   * @param is
   *          the input stream
   * @return the image metadata
   */
  protected RenderedOp readJAIMetadata(ImageContent content, InputStream is) {
    MemoryCacheSeekableStream imageInputStream = new MemoryCacheSeekableStream(is);
    RenderedOp jaiMetadata = JAI.create("stream", imageInputStream);

    if (jaiMetadata == null)
      return null;

View Full Code Here

Examples of com.sun.media.jai.codec.MemoryCacheSeekableStream

        JAIPreviewGenerator previewGenerator = new JAIPreviewGenerator();
        previewGenerator.createPreview(resource, Environment.Development, LanguageUtils.getLanguage("en"), style, null, is, bos);

        // Read the image back in
        bis = new ByteArrayInputStream(bos.toByteArray());
        SeekableStream seekableInputStream = new MemoryCacheSeekableStream(bis);
        RenderedOp image = JAI.create("stream", seekableInputStream);

        // Test width and height
        switch (style.getScalingMode()) {
          case Box:
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.