Examples of ByteArrayDataSource


Examples of org.apache.axiom.om.ds.ByteArrayDataSource

        QName name = omElement.getQName();
        String localName = name.getLocalPart();
        OMNamespace namespace = factory.createOMNamespace(name.getNamespaceURI(), name.getPrefix());
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        omElement.serialize(baos);
        ByteArrayDataSource bads = new ByteArrayDataSource(baos.toByteArray(), "utf-8");
        SOAPHeaderBlock block = factory.createSOAPHeaderBlock(localName, namespace, bads);
       
        return block;
    }
View Full Code Here

Examples of org.apache.axis2.attachments.ByteArrayDataSource

        OMAttribute cType1 = new OMAttributeImpl("contentType", mime,
                "text/plain");
        text.addAttribute(cType1);
        byte[] byteArray = new byte[]{13, 56, 65, 32, 12, 12, 7, -3, -2, -1,
                                      98};
        dataHandler = new DataHandler(new ByteArrayDataSource(byteArray));
        OMTextImpl textData = new OMTextImpl(dataHandler, false);

        envelope.addChild(body);
        body.addChild(data);
        data.addChild(text);
View Full Code Here

Examples of org.apache.commons.mail.ByteArrayDataSource

      else
      {
        // Normal Content
        final ByteArrayInputStream bin = new ByteArrayInputStream(data);
        final String contentId = (String) item.getContentId();
        final ByteArrayDataSource dataSource = new ByteArrayDataSource(bin, item.getMimeType());
        repository.getHtmlEmail().embed(dataSource, contentId, contentId);
        bin.close();

      }
    }
View Full Code Here

Examples of org.apache.openmeetings.util.mail.ByteArrayDataSource

    mimeMessage.addRecipients(Message.RecipientType.TO,
        InternetAddress.parse(recipients, false));

    // -- Create a new message --
    BodyPart msg = new MimeBodyPart();
    msg.setDataHandler(new DataHandler(new ByteArrayDataSource(htmlBody,
        "text/html; charset=\"utf-8\"")));

    Multipart multipart = new MimeMultipart();

    BodyPart iCalAttachment = new MimeBodyPart();
View Full Code Here

Examples of org.apache.openmeetings.utils.mail.ByteArrayDataSource

    mimeMessage.addRecipients(Message.RecipientType.TO,
        InternetAddress.parse(recipients, false));

    // -- Create a new message --
    BodyPart msg = new MimeBodyPart();
    msg.setDataHandler(new DataHandler(new ByteArrayDataSource(htmlBody,
        "text/html; charset=\"utf-8\"")));

    Multipart multipart = new MimeMultipart();

    BodyPart iCalAttachment = new MimeBodyPart();
View Full Code Here

Examples of org.apache.padaf.preflight.util.ByteArrayDataSource

     @Test()
     public void validate() throws Exception {
         ValidationResult result = null;
         try {
             InputStream input = this.getClass().getResourceAsStream(path);
             ByteArrayDataSource bds = new ByteArrayDataSource(input);
             result = validator.validate(bds);
             Assert.assertFalse(path + " : Isartor file should be invalid ("
                     + path + ")", result.isValid());
             Assert.assertTrue(path + " : Should find at least one error",
                     result.getErrorsList().size() > 0);
View Full Code Here

Examples of org.apache.pdfbox.preflight.utils.ByteArrayDataSource

        {
            InputStream input = new FileInputStream(file);
            ValidationResult result;
            try
            {
                PreflightParser parser = new PreflightParser(new ByteArrayDataSource(input));
                parser.parse();
                document = (PreflightDocument) parser.getPDDocument();
                // to speeds up tests, skip validation of page count is over the limit
                if (document.getNumberOfPages() < 8191)
                {
View Full Code Here

Examples of org.apache.servicemix.jbi.util.ByteArrayDataSource

        InOut me = dest.createInOutExchange();
        me.getInMessage().setContent(new StringSource(
                "<echo xmlns:xop='http://www.w3.org/2004/08/xop/include'><msg>"
                + "hello world</msg><binary><xop:Include href='binary'/></binary></echo>"));
        me.getInMessage().addAttachment("binary", new DataHandler(
                new ByteArrayDataSource(new byte[] {0, 1, 2}, "image/jpg")));
        client.sendSync(me);
        assertNotNull(me.getOutMessage());
        assertEquals(1, me.getOutMessage().getAttachmentNames().size());
        DataHandler dh = me.getOutMessage().getAttachment(
                (String) me.getOutMessage().getAttachmentNames().iterator().next());
View Full Code Here

Examples of org.apache.ws.commons.attachments.ByteArrayDataSource

        String contentType = org.apache.ws.commons.om.impl.MIMEOutputUtils
        .getContentTypeForMime(boundary, omOutput.getRootContentId(),
            omOutput.getCharSetEncoding(),SOAP12Constants.SOAP_12_CONTENT_TYPE);
        DataHandler dataHandler;
        dataHandler = new DataHandler(new ByteArrayDataSource(byteArray));
        OMText textData = factory.createText(dataHandler, true);
        assertNotNull(textData.getContentID());

        DataHandler dataHandler2 = new DataHandler(
                "Apache Software Foundation", "text/plain");
View Full Code Here

Examples of org.eclipse.persistence.internal.oxm.ByteArrayDataSource

    /**
    * <p><b>INTERNAL:</b> build a {@link DataHandler} backed by a
    * {@link ByteArrayDataSource}
    */
    public static Object buildAttachmentHandler(byte[] bytes, String mimeType) {
        return new DataHandler(new ByteArrayDataSource(bytes, mimeType));
    }
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.