Examples of ByteSourceFile


Examples of org.apache.sanselan.common.byteSources.ByteSourceFile

            // boolean ignoreImageData = isPhilHarveyTestImage(imageFile);
            // if (ignoreImageData)
            // continue;

            ByteSource byteSource = new ByteSourceFile(imageFile);
            // Debug.debug("Source Segments:");
            // new JpegUtils().dumpJFIF(byteSource);

            Map params = new HashMap();
            String xmpXml = new JpegImageParser().getXmpXml(byteSource, params);
            assertNotNull(xmpXml);

            // Debug.debug("xmpXml", xmpXml.length());
            // Debug.debug();

            File noXmpFile = createTempFile(imageFile.getName() + ".", ".jpg");
            {
                // test remove

                OutputStream os = null;
                try
                {
                    os = new FileOutputStream(noXmpFile);
                    os = new BufferedOutputStream(os);
                    new JpegXmpRewriter().removeXmpXml(byteSource, os);
                } finally
                {
                    if (os != null) {
                        os.close();
                    }
                    os = null;
                }

                // Debug.debug("Source Segments:");
                // new JpegUtils().dumpJFIF(new ByteSourceFile(noXmpFile));

                String outXmp = new JpegImageParser().getXmpXml(
                        new ByteSourceFile(noXmpFile), params);
                assertNull(outXmp);
            }

            {
                // test update

                String newXmpXml = "test";
                File updated = createTempFile(imageFile.getName() + ".", ".jpg");
                OutputStream os = null;
                try
                {
                    os = new FileOutputStream(updated);
                    os = new BufferedOutputStream(os);
                    new JpegXmpRewriter().updateXmpXml(byteSource, os,
                            newXmpXml);
                } finally
                {
                    if (os != null) {
                        os.close();
                    }
                    os = null;
                }

                // Debug.debug("Source Segments:");
                // new JpegUtils().dumpJFIF(new ByteSourceFile(updated));

                String outXmp = new JpegImageParser().getXmpXml(
                        new ByteSourceFile(updated), params);
                assertNotNull(outXmp);
                assertEquals(outXmp, newXmpXml);
            }

            {
                // test insert

                String newXmpXml = "test";
                File updated = createTempFile(imageFile.getName() + ".", ".jpg");
                OutputStream os = null;
                try
                {
                    os = new FileOutputStream(updated);
                    os = new BufferedOutputStream(os);
                    new JpegXmpRewriter().updateXmpXml(new ByteSourceFile(noXmpFile), os,
                            newXmpXml);
                } finally
                {
                    if (os != null) {
                        os.close();
                    }
                    os = null;
                }

                // Debug.debug("Source Segments:");
                // new JpegUtils().dumpJFIF(new ByteSourceFile(updated));

                String outXmp = new JpegImageParser().getXmpXml(
                        new ByteSourceFile(updated), params);
                assertNotNull(outXmp);
                assertEquals(outXmp, newXmpXml);
            }
        }
    }
View Full Code Here

Examples of org.apache.sanselan.common.byteSources.ByteSourceFile

            File imageFile = (File) images.get(i);
            Debug.debug("imageFile", imageFile);
            Debug.debug();

            ByteSource byteSource = new ByteSourceFile(imageFile);
            Map params = new HashMap();
            String xmpXml = new JpegImageParser().getXmpXml(byteSource, params );
            assertNotNull(xmpXml);

            Debug.debug("xmpXml", xmpXml);
View Full Code Here

Examples of org.apache.sanselan.common.byteSources.ByteSourceFile

        //        Debug.debug("possible file", file);

        try
        {
            ByteSource byteSource = new ByteSourceFile(file);
            return new JpegImageParser().hasXmpSegment(byteSource);
        }
        catch (Exception e)
        {
            //            Debug.debug("Error file", file.getAbsoluteFile());
View Full Code Here

Examples of org.apache.sanselan.common.byteSources.ByteSourceFile

    public IccProfileInfo getICCProfileInfo(File file)
    {
        if (file == null)
            return null;

        return getICCProfileInfo(new ByteSourceFile(file));
    }
View Full Code Here

Examples of org.apache.sanselan.common.byteSources.ByteSourceFile

    public Boolean issRGB(File file)
    {
        if (file == null)
            return null;

        return issRGB(new ByteSourceFile(file));
    }
View Full Code Here

Examples of org.apache.sanselan.common.byteSources.ByteSourceFile

   *         ImageFormat.IMAGE_FORMAT_UNKNOWN if the image type cannot be
   *         guessed.
   */
  public static ImageFormat guessFormat(File file) throws ImageReadException,
      IOException {
    return guessFormat(new ByteSourceFile(file));
  }
View Full Code Here

Examples of org.apache.sanselan.common.byteSources.ByteSourceFile

   * @return An instance of ICC_Profile or null if the image contains no ICC
   *         profile..
   */
  public static ICC_Profile getICCProfile(File file, Map params)
      throws ImageReadException, IOException {
    return getICCProfile(new ByteSourceFile(file), params);
  }
View Full Code Here

Examples of org.apache.sanselan.common.byteSources.ByteSourceFile

   * @see IccProfileParser
   * @see ICC_Profile
   */
  public static byte[] getICCProfileBytes(File file, Map params)
      throws ImageReadException, IOException {
    return getICCProfileBytes(new ByteSourceFile(file), params);
  }
View Full Code Here

Examples of org.apache.sanselan.common.byteSources.ByteSourceFile

   * @return An instance of ImageInfo.
   * @see ImageInfo
   */
  public static ImageInfo getImageInfo(File file, Map params)
      throws ImageReadException, IOException {
    return getImageInfo(new ByteSourceFile(file), params);
  }
View Full Code Here

Examples of org.apache.sanselan.common.byteSources.ByteSourceFile

   *            Map of optional parameters, defined in SanselanConstants.
   * @return The width and height of the image.
   */
  public static Dimension getImageSize(File file, Map params)
      throws ImageReadException, IOException {
    return getImageSize(new ByteSourceFile(file), params);
  }
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.