javax.mail.internet.MimeBodyPart.getContentStream()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(8.7k)|赞(0)|评价(0)|浏览(180)

本文整理了Java中javax.mail.internet.MimeBodyPart.getContentStream()方法的一些代码示例,展示了MimeBodyPart.getContentStream()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MimeBodyPart.getContentStream()方法的具体详情如下:
包路径:javax.mail.internet.MimeBodyPart
类名称:MimeBodyPart
方法名:getContentStream

MimeBodyPart.getContentStream介绍

[英]Produce the raw bytes of the content. This method is used when creating a DataHandler object for the content. Subclasses that can provide a separate input stream for just the Part content might want to override this method.
[中]生成内容的原始字节。为内容创建DataHandler对象时使用此方法。可以仅为零件内容提供单独输入流的子类可能希望重写此方法。

代码示例

代码示例来源:origin: camunda/camunda-bpm-platform

  1. /**
  2. * Return an InputStream to the raw data with any Content-Transfer-Encoding
  3. * intact. This method is useful if the "Content-Transfer-Encoding"
  4. * header is incorrect or corrupt, which would prevent the
  5. * <code>getInputStream</code> method or <code>getContent</code> method
  6. * from returning the correct data. In such a case the application may
  7. * use this method and attempt to decode the raw data itself. <p>
  8. *
  9. * This implementation simply calls the <code>getContentStream</code>
  10. * method.
  11. *
  12. * @return an InputStream containing the raw bytes
  13. * @exception MessagingException for failures
  14. * @see #getInputStream
  15. * @see #getContentStream
  16. * @since JavaMail 1.2
  17. */
  18. public InputStream getRawInputStream() throws MessagingException {
  19. return getContentStream();
  20. }

代码示例来源:origin: com.sun.mail/javax.mail

  1. /**
  2. * Return an InputStream to the raw data with any Content-Transfer-Encoding
  3. * intact. This method is useful if the "Content-Transfer-Encoding"
  4. * header is incorrect or corrupt, which would prevent the
  5. * <code>getInputStream</code> method or <code>getContent</code> method
  6. * from returning the correct data. In such a case the application may
  7. * use this method and attempt to decode the raw data itself. <p>
  8. *
  9. * This implementation simply calls the <code>getContentStream</code>
  10. * method.
  11. *
  12. * @return an InputStream containing the raw bytes
  13. * @exception MessagingException for failures
  14. * @see #getInputStream
  15. * @see #getContentStream
  16. * @since JavaMail 1.2
  17. */
  18. public InputStream getRawInputStream() throws MessagingException {
  19. return getContentStream();
  20. }

代码示例来源:origin: camunda/camunda-bpm-platform

  1. InputStream getContentStream() throws MessagingException {
  2. InputStream is = null;
  3. if (part instanceof MimeBodyPart) {
  4. MimeBodyPart mbp = (MimeBodyPart)part;
  5. is = mbp.getContentStream();
  6. } else if (part instanceof MimeMessage) {
  7. MimeMessage msg = (MimeMessage)part;
  8. is = msg.getContentStream();
  9. }
  10. return is;
  11. }

代码示例来源:origin: com.sun.mail/javax.mail

  1. InputStream getContentStream() throws MessagingException {
  2. InputStream is = null;
  3. if (part instanceof MimeBodyPart) {
  4. MimeBodyPart mbp = (MimeBodyPart)part;
  5. is = mbp.getContentStream();
  6. } else if (part instanceof MimeMessage) {
  7. MimeMessage msg = (MimeMessage)part;
  8. is = msg.getContentStream();
  9. }
  10. return is;
  11. }

代码示例来源:origin: camunda/camunda-bpm-platform

  1. is = ((MimeBodyPart)part).getContentStream();
  2. else if (part instanceof MimeMessage)
  3. is = ((MimeMessage)part).getContentStream();

代码示例来源:origin: com.sun.mail/javax.mail

  1. is = ((MimeBodyPart)part).getContentStream();
  2. else if (part instanceof MimeMessage)
  3. is = ((MimeMessage)part).getContentStream();

代码示例来源:origin: org.apache.geronimo.specs/geronimo-javamail_1.4_spec

  1. public InputStream getRawInputStream() throws MessagingException {
  2. return getContentStream();
  3. }

代码示例来源:origin: org.apache.geronimo.specs/geronimo-javamail_1.3.1_spec

  1. public InputStream getRawInputStream() throws MessagingException {
  2. return getContentStream();
  3. }

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.javax.mail

  1. /**
  2. * Return an InputStream to the raw data with any Content-Transfer-Encoding
  3. * intact. This method is useful if the "Content-Transfer-Encoding"
  4. * header is incorrect or corrupt, which would prevent the
  5. * <code>getInputStream</code> method or <code>getContent</code> method
  6. * from returning the correct data. In such a case the application may
  7. * use this method and attempt to decode the raw data itself. <p>
  8. *
  9. * This implementation simply calls the <code>getContentStream</code>
  10. * method.
  11. *
  12. * @see #getInputStream
  13. * @see #getContentStream
  14. * @since JavaMail 1.2
  15. */
  16. public InputStream getRawInputStream() throws MessagingException {
  17. return getContentStream();
  18. }

代码示例来源:origin: javax.mail/com.springsource.javax.mail

  1. /**
  2. * Return an InputStream to the raw data with any Content-Transfer-Encoding
  3. * intact. This method is useful if the "Content-Transfer-Encoding"
  4. * header is incorrect or corrupt, which would prevent the
  5. * <code>getInputStream</code> method or <code>getContent</code> method
  6. * from returning the correct data. In such a case the application may
  7. * use this method and attempt to decode the raw data itself. <p>
  8. *
  9. * This implementation simply calls the <code>getContentStream</code>
  10. * method.
  11. *
  12. * @see #getInputStream
  13. * @see #getContentStream
  14. * @since JavaMail 1.2
  15. */
  16. public InputStream getRawInputStream() throws MessagingException {
  17. return getContentStream();
  18. }

代码示例来源:origin: javax.mail/javax.mail-api

  1. /**
  2. * Return an InputStream to the raw data with any Content-Transfer-Encoding
  3. * intact. This method is useful if the "Content-Transfer-Encoding"
  4. * header is incorrect or corrupt, which would prevent the
  5. * <code>getInputStream</code> method or <code>getContent</code> method
  6. * from returning the correct data. In such a case the application may
  7. * use this method and attempt to decode the raw data itself. <p>
  8. *
  9. * This implementation simply calls the <code>getContentStream</code>
  10. * method.
  11. *
  12. * @return an InputStream containing the raw bytes
  13. * @exception MessagingException for failures
  14. * @see #getInputStream
  15. * @see #getContentStream
  16. * @since JavaMail 1.2
  17. */
  18. public InputStream getRawInputStream() throws MessagingException {
  19. return getContentStream();
  20. }

代码示例来源:origin: com.sun.mail/mailapi

  1. InputStream getContentStream() throws MessagingException {
  2. InputStream is = null;
  3. if (part instanceof MimeBodyPart) {
  4. MimeBodyPart mbp = (MimeBodyPart)part;
  5. is = mbp.getContentStream();
  6. } else if (part instanceof MimeMessage) {
  7. MimeMessage msg = (MimeMessage)part;
  8. is = msg.getContentStream();
  9. }
  10. return is;
  11. }

代码示例来源:origin: com.sun.mail/android-mail

  1. InputStream getContentStream() throws MessagingException {
  2. InputStream is = null;
  3. if (part instanceof MimeBodyPart) {
  4. MimeBodyPart mbp = (MimeBodyPart)part;
  5. is = mbp.getContentStream();
  6. } else if (part instanceof MimeMessage) {
  7. MimeMessage msg = (MimeMessage)part;
  8. is = msg.getContentStream();
  9. }
  10. return is;
  11. }

代码示例来源:origin: javax.mail/javax.mail-api

  1. InputStream getContentStream() throws MessagingException {
  2. InputStream is = null;
  3. if (part instanceof MimeBodyPart) {
  4. MimeBodyPart mbp = (MimeBodyPart)part;
  5. is = mbp.getContentStream();
  6. } else if (part instanceof MimeMessage) {
  7. MimeMessage msg = (MimeMessage)part;
  8. is = msg.getContentStream();
  9. }
  10. return is;
  11. }

代码示例来源:origin: com.sun.mail/jakarta.mail

  1. InputStream getContentStream() throws MessagingException {
  2. InputStream is = null;
  3. if (part instanceof MimeBodyPart) {
  4. MimeBodyPart mbp = (MimeBodyPart)part;
  5. is = mbp.getContentStream();
  6. } else if (part instanceof MimeMessage) {
  7. MimeMessage msg = (MimeMessage)part;
  8. is = msg.getContentStream();
  9. }
  10. return is;
  11. }

代码示例来源:origin: org.glassfish.metro/webservices-extra

  1. InputStream getContentStream() throws MessagingException {
  2. InputStream is = null;
  3. if (part instanceof MimeBodyPart) {
  4. MimeBodyPart mbp = (MimeBodyPart)part;
  5. is = mbp.getContentStream();
  6. } else if (part instanceof MimeMessage) {
  7. MimeMessage msg = (MimeMessage)part;
  8. is = msg.getContentStream();
  9. }
  10. return is;
  11. }

代码示例来源:origin: jboss/jboss-javaee-specs

  1. InputStream getContentStream() throws MessagingException {
  2. InputStream is = null;
  3. if (part instanceof MimeBodyPart) {
  4. MimeBodyPart mbp = (MimeBodyPart)part;
  5. is = mbp.getContentStream();
  6. } else if (part instanceof MimeMessage) {
  7. MimeMessage msg = (MimeMessage)part;
  8. is = msg.getContentStream();
  9. }
  10. return is;
  11. }

代码示例来源:origin: org.apache.geronimo.javamail/geronimo-javamail_1.4_provider

  1. protected InputStream getContentStream() throws MessagingException {
  2. // no content loaded yet?
  3. if (content == null) {
  4. // make sure we're still valid
  5. message.checkValidity();
  6. // make sure the content is fully loaded
  7. loadContent();
  8. }
  9. // allow the super class to handle creating it from the loaded content.
  10. return super.getContentStream();
  11. }

代码示例来源:origin: org.apache.geronimo.specs/geronimo-javamail_1.4_spec

  1. public InputStream getInputStream() throws IOException {
  2. try {
  3. InputStream stream;
  4. if (part instanceof MimeMessage) {
  5. stream = ((MimeMessage) part).getContentStream();
  6. } else if (part instanceof MimeBodyPart) {
  7. stream = ((MimeBodyPart) part).getContentStream();
  8. } else {
  9. throw new MessagingException("Unknown part");
  10. }
  11. return checkPartEncoding(part, stream);
  12. } catch (MessagingException e) {
  13. throw (IOException) new IOException(e.getMessage()).initCause(e);
  14. }
  15. }

代码示例来源:origin: org.apache.geronimo.specs/geronimo-javamail_1.3.1_spec

  1. public InputStream getInputStream() throws IOException {
  2. try {
  3. InputStream stream;
  4. if (part instanceof MimeMessage) {
  5. stream = ((MimeMessage) part).getContentStream();
  6. } else if (part instanceof MimeBodyPart) {
  7. stream = ((MimeBodyPart) part).getContentStream();
  8. } else {
  9. throw new MessagingException("Unknown part");
  10. }
  11. String encoding = part.getEncoding();
  12. return encoding == null ? stream : MimeUtility.decode(stream, encoding);
  13. } catch (MessagingException e) {
  14. throw (IOException) new IOException(e.getMessage()).initCause(e);
  15. }
  16. }

相关文章