Examples of TextBody


Examples of org.apache.james.mime4j.message.TextBody

    /**
     * Creates a text part from the specified string.
     */
    private static BodyPart createTextPart(BodyFactory bodyFactory, String text) {
        // Use UTF-8 to encode the specified text
        TextBody body = bodyFactory.textBody(text, "UTF-8");

        // Create a text/plain body part
        BodyPart bodyPart = new BodyPart();
        bodyPart.setText(body);
        bodyPart.setContentTransferEncoding("quoted-printable");
View Full Code Here

Examples of org.apache.james.mime4j.message.TextBody

           
            if (o instanceof TextBody){
                /*
                 * A text body. Display its contents.
                 */
                TextBody body = (TextBody) o;
                StringBuilder sb = new StringBuilder();
                try {
                    Reader r = body.getReader();
                    int c;
                    while ((c = r.read()) != -1) {
                        sb.append((char) c);
                    }
                } catch (IOException ex) {
                    ex.printStackTrace();
                }
                textView.setText(sb.toString());
               
            } else if (o instanceof BinaryBody){
                /*
                 * A binary body. Display its MIME type and length in bytes.
                 */
                BinaryBody body = (BinaryBody) o;
                int size = 0;
                try {
                    InputStream is = body.getInputStream();
                    while ((is.read()) != -1) {
                        size++;
                    }
                } catch (IOException ex) {
                    ex.printStackTrace();
                }
                textView.setText("Binary body\n"
                               + "MIME type: "
                                   + body.getParent().getMimeType() + "\n"
                               + "Size of decoded data: " + size + " bytes");
               
            } else if (o instanceof ContentTypeField) {
                /*
                 * Content-Type field.
View Full Code Here

Examples of org.apache.james.mime4j.message.TextBody

    /**
     * Creates a text part from the specified string.
     */
    private static BodyPart createTextPart(String text) {
        TextBody body = new BodyFactory().textBody(text, "UTF-8");

        BodyPart bodyPart = new BodyPart();
        bodyPart.setText(body);
        bodyPart.setContentTransferEncoding("quoted-printable");

View Full Code Here

Examples of org.apache.james.mime4j.message.TextBody

           
            if (o instanceof TextBody){
                /*
                 * A text body. Display its contents.
                 */
                TextBody body = (TextBody) o;
                StringBuffer sb = new StringBuffer();
                try {
                    Reader r = body.getReader();
                    int c;
                    while ((c = r.read()) != -1) {
                        sb.append((char) c);
                    }
                } catch (IOException ex) {
                    ex.printStackTrace();
                }
                textView.setText(sb.toString());
               
            } else if (o instanceof BinaryBody){
                /*
                 * A binary body. Display its MIME type and length in bytes.
                 */
                BinaryBody body = (BinaryBody) o;
                int size = 0;
                try {
                    InputStream is = body.getInputStream();
                    while ((is.read()) != -1) {
                        size++;
                    }
                } catch (IOException ex) {
                    ex.printStackTrace();
                }
                textView.setText("Binary body\n"
                               + "MIME type: "
                                   + body.getParent().getMimeType() + "\n"
                               + "Size of decoded data: " + size + " bytes");
               
            } else if (o instanceof ContentTypeField) {
                /*
                 * Content-Type field.
View Full Code Here

Examples of org.jboss.soa.esb.message.body.content.TextBody

  {
    Message msg = MessageFactory.getInstance().getMessage(MessageType.JAVA_SERIALIZED);

    assertEquals((msg != null), true);

    TextBody textMessage = Payload.createTextBody(msg);

    textMessage.setText("hello world");

    assertEquals(textMessage.getText(), "hello world");
  }
View Full Code Here

Examples of org.jboss.soa.esb.message.body.content.TextBody

public class SerializedContentManagerUnitTest extends TestCase
{
  public void testTextMessage () throws Exception
  {
    Message msg = _factory.createTextMessage("hello world");   
    TextBody body = (TextBody) msg.getBody();
   
    assertEquals(body.getText(), "hello world");
  }
View Full Code Here

Examples of org.jboss.soa.esb.message.body.content.TextBody

public class XMLContentManagerUnitTest extends TestCase
{
  public void testTextMessage () throws Exception
  {
    Message msg = _factory.createTextMessage("hello world");   
    TextBody body = (TextBody) msg.getBody();
   
    assertEquals(body.getText(), "hello world");
  }
View Full Code Here

Examples of org.jboss.soa.esb.message.body.content.TextBody

   
    Message msg = MessageFactory.getInstance().getMessage(_type);
   
    try
    {
      TextBody payload = (TextBody) MessageFactory.getInstance().createBodyType(msg, Payload.TEXT_BODY);
     
      payload.setText(initial);
     
      return msg;
    }
    catch (Exception ex)
    {
View Full Code Here

Examples of org.mime4j.message.TextBody

           
            if (o instanceof TextBody){
                /*
                 * A text body. Display its contents.
                 */
                TextBody body = (TextBody) o;
                StringBuffer sb = new StringBuffer();
                try {
                    Reader r = body.getReader();
                    int c;
                    while ((c = r.read()) != -1) {
                        sb.append((char) c);
                    }
                } catch (IOException ex) {
                    ex.printStackTrace();
                }
                textView.setText(sb.toString());
               
            } else if (o instanceof BinaryBody){
                /*
                 * A binary body. Display its MIME type and length in bytes.
                 */
                BinaryBody body = (BinaryBody) o;
                int size = 0;
                try {
                    InputStream is = body.getInputStream();
                    int b;
                    while ((b = is.read()) != -1) {
                        size++;
                    }
                } catch (IOException ex) {
                    ex.printStackTrace();
                }
                textView.setText("Binary body\n"
                               + "MIME type: "
                                   + body.getParent().getMimeType() + "\n"
                               + "Size of decoded data: " + size + " bytes");
               
            } else if (o instanceof ContentTypeField) {
                /*
                 * Content-Type field.
View Full Code Here

Examples of org.opendope.SmartArt.dataHierarchy.TextBody

      CTPt thisPoint) {
   
    CTTextBody textBody = thisPoint.getT();
    if (textBody!=null) {
     
      TextBody tb = getDataHierarchyObjectFactory().createTextBody();
      thisListItem.setTextBody(tb);
     
      for(CTTextParagraph p : textBody.getP() ) {
       
        if (!p.getEGTextRun().isEmpty()
            && p.getEGTextRun().get(0) instanceof org.docx4j.dml.CTRegularTextRun
            ) {
          // TODO; assumes a single r child, which is
          // all we handle.  ie this model doesn't support
          // multiple runs, some of which formatted
         
          org.docx4j.dml.CTRegularTextRun run = (org.docx4j.dml.CTRegularTextRun)p.getEGTextRun().get(0);
         
          tb.getP().add( run.getT() );         
        }
      }
     
    }
    return textBody;
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.