Package javax.activation

Examples of javax.activation.DataHandler.writeTo()


    {
        DataHandler dataHandler = mimeMessage.getDataHandler();
        ByteArrayOutputStream byteArrayOutStream = new ByteArrayOutputStream();
        BufferedOutputStream buffOs = new BufferedOutputStream(
                byteArrayOutStream);
        dataHandler.writeTo(buffOs);
        buffOs.flush();

        return byteArrayOutStream.toByteArray();
    }
View Full Code Here


          } else if (type.equals(STRING)) {
            this.put((Object)name, text.getText());
          } else if (type.equals(BYTEARRAY)) {
            DataHandler dh = (DataHandler)text.getDataHandler();
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            dh.writeTo(baos);
            this.put((Object)name, baos.toByteArray());
          }
          } catch (Exception e) {
            e.printStackTrace();
            // ignore errors
View Full Code Here

    {
        final DataHandler dataHandler = mimeMessage.getDataHandler();
        final ByteArrayOutputStream byteArrayOutStream = new ByteArrayOutputStream();
        final BufferedOutputStream buffOs = new BufferedOutputStream(
                byteArrayOutStream);
        dataHandler.writeTo(buffOs);
        buffOs.flush();

        return byteArrayOutStream.toByteArray();
    }
View Full Code Here

  }
 
  protected String getMessage(MimeMessage mimeMessage) throws MessagingException, IOException {
    DataHandler dataHandler = mimeMessage.getDataHandler();
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    dataHandler.writeTo(baos);
    baos.flush();
    return baos.toString();
  }

}
View Full Code Here

  }
 
  public static String getMessage(MimeMessage mimeMessage) throws MessagingException, IOException {
    DataHandler dataHandler = mimeMessage.getDataHandler();
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    dataHandler.writeTo(baos);
    baos.flush();
    return baos.toString();
  }

}
View Full Code Here

            Attachments attachment = response.getAttachmentMap();
            dataHandler = attachment.getDataHandler(imageContentId);
            File tempFile = File.createTempFile("swa-", ".gif");
            FileOutputStream fos = new FileOutputStream(tempFile);
            dataHandler.writeTo(fos);
            fos.flush();
            fos.close();

            log.info("Saved response to file : " + tempFile.getAbsolutePath());
            clientResult.incrementResponseCount();
View Full Code Here

                     }

                     if (href != null) {
                         DataHandler binaryDataHandler = msgCtx.getAttachment(href.substring(4));
                         ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
                         binaryDataHandler.writeTo(outputStream);
                         value = new String(outputStream.toByteArray());
                     }
                }
                else {
                     value = bodyNode.getText();
View Full Code Here

                        }

                        if (href != null) {
                            DataHandler binaryDataHandler = msgCtx.getAttachment(href.substring(4));
                            ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
                            binaryDataHandler.writeTo(outputStream);
                            value = new String(outputStream.toByteArray());
                        }
                    } else {
                        value = headerNode.getText();
                    }
View Full Code Here

                                getAttributeValue(new QName(FIXConstants.FIX_MESSAGE_REFERENCE));
                        }
                        if (href != null) {
                            DataHandler binaryDataHandler = msgCtx.getAttachment(href.substring(4));
                            ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
                            binaryDataHandler.writeTo(outputStream);
                            value = new String(outputStream.toByteArray());
                        }
                    } else {
                        value = trailerNode.getText();
                    }
View Full Code Here

  {
    if (value != null) {
      DataHandler handler = (DataHandler) value;
      ByteArrayOutputStream baos = new ByteArrayOutputStream();

      handler.writeTo(baos);

      return Base64.encodeFromByteArray(baos.toByteArray());
    }

    return "";
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.