Package org.apache.sanselan.common.byteSources

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


     *            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

     *            Map of optional parameters, defined in SanselanConstants.
     * @return Xmp Xml as String, if present. Otherwise, returns null.
     */
    public static String getXmpXml(File file, Map params)
            throws ImageReadException, IOException {
        return getXmpXml(new ByteSourceFile(file), params);
    }
View Full Code Here

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

     *            File containing image data.
     * @return A description of the image file's structure.
     */
    public static String dumpImageFile(File file) throws ImageReadException,
            IOException {
        return dumpImageFile(new ByteSourceFile(file));
    }
View Full Code Here

        return getFormatCompliance(new ByteSourceArray(bytes));
    }

    public static FormatCompliance getFormatCompliance(File file)
            throws ImageReadException, IOException {
        return getFormatCompliance(new ByteSourceFile(file));
    }
View Full Code Here

     *            File containing image data.
     * @return A vector of BufferedImages.
     */
    public static ArrayList getAllBufferedImages(File file)
            throws ImageReadException, IOException {
        return getAllBufferedImages(new ByteSourceFile(file));
    }
View Full Code Here

     * @return A BufferedImage.
     * @see SanselanConstants
     */
    public static BufferedImage getBufferedImage(File file)
            throws ImageReadException, IOException {
        return getBufferedImage(new ByteSourceFile(file), null);
    }
View Full Code Here

     * @return A BufferedImage.
     * @see SanselanConstants
     */
    public static BufferedImage getBufferedImage(File file, Map params)
            throws ImageReadException, IOException {
        return getBufferedImage(new ByteSourceFile(file), params);
    }
View Full Code Here

            // 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

TOP

Related Classes of org.apache.sanselan.common.byteSources.ByteSourceFile

Copyright © 2018 www.massapicom. 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.