本文整理了Java中javax.mail.internet.MimeMessage.createInternetHeaders()
方法的一些代码示例,展示了MimeMessage.createInternetHeaders()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MimeMessage.createInternetHeaders()
方法的具体详情如下:
包路径:javax.mail.internet.MimeMessage
类名称:MimeMessage
方法名:createInternetHeaders
[英]Create and return an InternetHeaders object that loads the headers from the given InputStream. Subclasses can override this method to return a subclass of InternetHeaders, if necessary. This implementation simply constructs and returns an InternetHeaders object.
[中]创建并返回InternetHeaders对象,该对象从给定的InputStream加载头。如有必要,子类可以重写此方法以返回InternetHeaders的子类。这个实现只是构造并返回InternetHeaders对象。
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* Parse the InputStream setting the <code>headers</code> and
* <code>content</code> fields appropriately. Also resets the
* <code>modified</code> flag. <p>
*
* This method is intended for use by subclasses that need to
* control when the InputStream is parsed.
*
* @param is The message input stream
* @exception MessagingException for failures
*/
protected void parse(InputStream is) throws MessagingException {
if (!(is instanceof ByteArrayInputStream) &&
!(is instanceof BufferedInputStream) &&
!(is instanceof SharedInputStream))
is = new BufferedInputStream(is);
headers = createInternetHeaders(is);
if (is instanceof SharedInputStream) {
SharedInputStream sis = (SharedInputStream)is;
contentStream = sis.newStream(sis.getPosition(), -1);
} else {
try {
content = ASCIIUtility.getBytes(is);
} catch (IOException ioex) {
throw new MessagingException("IOException", ioex);
}
}
modified = false;
}
代码示例来源:origin: com.sun.mail/javax.mail
/**
* Parse the InputStream setting the <code>headers</code> and
* <code>content</code> fields appropriately. Also resets the
* <code>modified</code> flag. <p>
*
* This method is intended for use by subclasses that need to
* control when the InputStream is parsed.
*
* @param is The message input stream
* @exception MessagingException for failures
*/
protected void parse(InputStream is) throws MessagingException {
if (!(is instanceof ByteArrayInputStream) &&
!(is instanceof BufferedInputStream) &&
!(is instanceof SharedInputStream))
is = new BufferedInputStream(is);
headers = createInternetHeaders(is);
if (is instanceof SharedInputStream) {
SharedInputStream sis = (SharedInputStream)is;
contentStream = sis.newStream(sis.getPosition(), -1);
} else {
try {
content = ASCIIUtility.getBytes(is);
} catch (IOException ioex) {
throw new MessagingException("IOException", ioex);
}
}
modified = false;
}
代码示例来源:origin: org.apache.geronimo.specs/geronimo-javamail_1.4_spec
/**
* Parse the supplied stream and initialize {@link #headers} and {@link #content} appropriately.
*
* @param in the stream to read
* @throws MessagingException if there was a problem parsing the stream
*/
protected void parse(InputStream in) throws MessagingException {
in = new BufferedInputStream(in);
// create the headers first from the stream. Note: We need to do this
// by calling createInternetHeaders because subclasses might wish to add
// additional headers to the set initialized from the stream.
headers = createInternetHeaders(in);
// now we need to get the rest of the content as a byte array...this means reading from the current
// position in the stream until the end and writing it to an accumulator ByteArrayOutputStream.
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
byte buffer[] = new byte[1024];
int count;
while ((count = in.read(buffer, 0, 1024)) != -1) {
baos.write(buffer, 0, count);
}
} catch (Exception e) {
throw new MessagingException(e.toString(), e);
}
// and finally extract the content as a byte array.
content = baos.toByteArray();
}
代码示例来源:origin: javax.mail/javax.mail-api
/**
* Parse the InputStream setting the <code>headers</code> and
* <code>content</code> fields appropriately. Also resets the
* <code>modified</code> flag. <p>
*
* This method is intended for use by subclasses that need to
* control when the InputStream is parsed.
*
* @param is The message input stream
* @exception MessagingException for failures
*/
protected void parse(InputStream is) throws MessagingException {
if (!(is instanceof ByteArrayInputStream) &&
!(is instanceof BufferedInputStream) &&
!(is instanceof SharedInputStream))
is = new BufferedInputStream(is);
headers = createInternetHeaders(is);
if (is instanceof SharedInputStream) {
SharedInputStream sis = (SharedInputStream)is;
contentStream = sis.newStream(sis.getPosition(), -1);
} else {
try {
content = ASCIIUtility.getBytes(is);
} catch (IOException ioex) {
throw new MessagingException("IOException", ioex);
}
}
modified = false;
}
代码示例来源:origin: com.sun.mail/jakarta.mail
/**
* Parse the InputStream setting the <code>headers</code> and
* <code>content</code> fields appropriately. Also resets the
* <code>modified</code> flag. <p>
*
* This method is intended for use by subclasses that need to
* control when the InputStream is parsed.
*
* @param is The message input stream
* @exception MessagingException for failures
*/
protected void parse(InputStream is) throws MessagingException {
if (!(is instanceof ByteArrayInputStream) &&
!(is instanceof BufferedInputStream) &&
!(is instanceof SharedInputStream))
is = new BufferedInputStream(is);
headers = createInternetHeaders(is);
if (is instanceof SharedInputStream) {
SharedInputStream sis = (SharedInputStream)is;
contentStream = sis.newStream(sis.getPosition(), -1);
} else {
try {
content = ASCIIUtility.getBytes(is);
} catch (IOException ioex) {
throw new MessagingException("IOException", ioex);
}
}
modified = false;
}
代码示例来源:origin: javax.mail/com.springsource.javax.mail
/**
* Parse the InputStream setting the <code>headers</code> and
* <code>content</code> fields appropriately. Also resets the
* <code>modified</code> flag. <p>
*
* This method is intended for use by subclasses that need to
* control when the InputStream is parsed.
*
* @param is The message input stream
* @exception MessagingException
*/
protected void parse(InputStream is) throws MessagingException {
if (!(is instanceof ByteArrayInputStream) &&
!(is instanceof BufferedInputStream) &&
!(is instanceof SharedInputStream))
is = new BufferedInputStream(is);
headers = createInternetHeaders(is);
if (is instanceof SharedInputStream) {
SharedInputStream sis = (SharedInputStream)is;
contentStream = sis.newStream(sis.getPosition(), -1);
} else {
try {
content = ASCIIUtility.getBytes(is);
} catch (IOException ioex) {
throw new MessagingException("IOException", ioex);
}
}
modified = false;
}
代码示例来源:origin: org.glassfish.metro/webservices-extra
/**
* Parse the InputStream setting the <code>headers</code> and
* <code>content</code> fields appropriately. Also resets the
* <code>modified</code> flag. <p>
*
* This method is intended for use by subclasses that need to
* control when the InputStream is parsed.
*
* @param is The message input stream
* @exception MessagingException for failures
*/
protected void parse(InputStream is) throws MessagingException {
if (!(is instanceof ByteArrayInputStream) &&
!(is instanceof BufferedInputStream) &&
!(is instanceof SharedInputStream))
is = new BufferedInputStream(is);
headers = createInternetHeaders(is);
if (is instanceof SharedInputStream) {
SharedInputStream sis = (SharedInputStream)is;
contentStream = sis.newStream(sis.getPosition(), -1);
} else {
try {
content = ASCIIUtility.getBytes(is);
} catch (IOException ioex) {
throw new MessagingException("IOException", ioex);
}
}
modified = false;
}
代码示例来源:origin: com.sun.mail/mailapi
/**
* Parse the InputStream setting the <code>headers</code> and
* <code>content</code> fields appropriately. Also resets the
* <code>modified</code> flag. <p>
*
* This method is intended for use by subclasses that need to
* control when the InputStream is parsed.
*
* @param is The message input stream
* @exception MessagingException for failures
*/
protected void parse(InputStream is) throws MessagingException {
if (!(is instanceof ByteArrayInputStream) &&
!(is instanceof BufferedInputStream) &&
!(is instanceof SharedInputStream))
is = new BufferedInputStream(is);
headers = createInternetHeaders(is);
if (is instanceof SharedInputStream) {
SharedInputStream sis = (SharedInputStream)is;
contentStream = sis.newStream(sis.getPosition(), -1);
} else {
try {
content = ASCIIUtility.getBytes(is);
} catch (IOException ioex) {
throw new MessagingException("IOException", ioex);
}
}
modified = false;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.javax.mail
/**
* Parse the InputStream setting the <code>headers</code> and
* <code>content</code> fields appropriately. Also resets the
* <code>modified</code> flag. <p>
*
* This method is intended for use by subclasses that need to
* control when the InputStream is parsed.
*
* @param is The message input stream
* @exception MessagingException
*/
protected void parse(InputStream is) throws MessagingException {
if (!(is instanceof ByteArrayInputStream) &&
!(is instanceof BufferedInputStream) &&
!(is instanceof SharedInputStream))
is = new BufferedInputStream(is);
headers = createInternetHeaders(is);
if (is instanceof SharedInputStream) {
SharedInputStream sis = (SharedInputStream)is;
contentStream = sis.newStream(sis.getPosition(), -1);
} else {
try {
content = ASCIIUtility.getBytes(is);
} catch (IOException ioex) {
throw new MessagingException("IOException", ioex);
}
}
modified = false;
}
代码示例来源:origin: com.sun.mail/android-mail
/**
* Parse the InputStream setting the <code>headers</code> and
* <code>content</code> fields appropriately. Also resets the
* <code>modified</code> flag. <p>
*
* This method is intended for use by subclasses that need to
* control when the InputStream is parsed.
*
* @param is The message input stream
* @exception MessagingException for failures
*/
protected void parse(InputStream is) throws MessagingException {
if (!(is instanceof ByteArrayInputStream) &&
!(is instanceof BufferedInputStream) &&
!(is instanceof SharedInputStream))
is = new BufferedInputStream(is);
headers = createInternetHeaders(is);
if (is instanceof SharedInputStream) {
SharedInputStream sis = (SharedInputStream)is;
contentStream = sis.newStream(sis.getPosition(), -1);
} else {
try {
content = ASCIIUtility.getBytes(is);
} catch (IOException ioex) {
throw new MessagingException("IOException", ioex);
}
}
modified = false;
}
代码示例来源:origin: jboss/jboss-javaee-specs
/**
* Parse the InputStream setting the <code>headers</code> and
* <code>content</code> fields appropriately. Also resets the
* <code>modified</code> flag. <p>
*
* This method is intended for use by subclasses that need to
* control when the InputStream is parsed.
*
* @param is The message input stream
* @exception MessagingException for failures
*/
protected void parse(InputStream is) throws MessagingException {
if (!(is instanceof ByteArrayInputStream) &&
!(is instanceof BufferedInputStream) &&
!(is instanceof SharedInputStream))
is = new BufferedInputStream(is);
headers = createInternetHeaders(is);
if (is instanceof SharedInputStream) {
SharedInputStream sis = (SharedInputStream)is;
contentStream = sis.newStream(sis.getPosition(), -1);
} else {
try {
content = ASCIIUtility.getBytes(is);
} catch (IOException ioex) {
throw new MessagingException("IOException", ioex);
}
}
modified = false;
}
内容来源于网络,如有侵权,请联系作者删除!