Package org.apache.axiom.attachments.utils

Examples of org.apache.axiom.attachments.utils.ImageDataSource


    public void testGetInputAttachhmentStreams() throws Exception {

        Image expectedImage;
        IncomingAttachmentInputStream dataIs;
        ImageDataSource dataSource;
        InputStream expectedDataIs;

        InputStream inStream = new FileInputStream(getTestResourceFile(inMimeFileName));
        Attachments attachments = new Attachments(inStream, contentTypeString);

        // Since SOAP part operated independently of other streams, access it
        // directly, and then get to the streams. If this sequence throws an
        // error, something is wrong with the stream handling code.
        InputStream is = attachments.getSOAPPartInputStream();
        while (is.read() != -1);

        // Get the inputstream container
        IncomingAttachmentStreams ias = attachments.getIncomingAttachmentStreams();

        dataIs = ias.getNextStream();
        expectedImage = ImageIO.read(new FileInputStream(getTestResourceFile(img1FileName)));
        dataSource = new ImageDataSource("test1.jpg", expectedImage);
        expectedDataIs = dataSource.getInputStream();
        compareStreams(dataIs, expectedDataIs);

        dataIs = ias.getNextStream();
        expectedImage = ImageIO.read(new FileInputStream(getTestResourceFile(img2FileName)));
        dataSource = new ImageDataSource("test2.jpg", expectedImage);
        expectedDataIs = dataSource.getInputStream();
        compareStreams(dataIs, expectedDataIs);

        // Confirm that no more streams are left
        assertEquals(null, ias.getNextStream());
View Full Code Here


        DataHandler dh = attachments.getDataHandler("2.urn:uuid:A3ADBAEE51A1A87B2A11443668160994@apache.org");
        InputStream dataIs = dh.getDataSource().getInputStream();

        Image expectedImage = ImageIO.read(new FileInputStream(getTestResourceFile(img2FileName)));
        ImageDataSource dataSource = new ImageDataSource("test.jpg", expectedImage);
        InputStream expectedDataIs = dataSource.getInputStream();

        // Compare data across streams
        compareStreams(dataIs, expectedDataIs);
    }
View Full Code Here

        expectedImage =
                new ImageIO().loadImage(
                        new FileInputStream(
                                getTestResourceFile(imageInFileName)));
        ImageDataSource dataSource = new ImageDataSource("WaterLilies.jpg",
                expectedImage);
        expectedDH = new DataHandler(dataSource);
        OMText binaryNode = new OMTextImpl(expectedDH, true, fac);

        envelope.addChild(body);
View Full Code Here

        OMElement image = fac.createOMElement("image", omNs);
        Image expectedImage;
        expectedImage = new ImageIO()
                .loadImage(new FileInputStream(inputFile));

        ImageDataSource dataSource = new ImageDataSource("test.jpg",
                expectedImage);
        expectedDH = new DataHandler(dataSource);
        OMText textData = fac.createOMText(expectedDH, true);
        image.addChild(textData);
View Full Code Here

TOP

Related Classes of org.apache.axiom.attachments.utils.ImageDataSource

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.