本文整理了Java中javax.mail.util.SharedByteArrayInputStream.<init>()
方法的一些代码示例,展示了SharedByteArrayInputStream.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SharedByteArrayInputStream.<init>()
方法的具体详情如下:
包路径:javax.mail.util.SharedByteArrayInputStream
类名称:SharedByteArrayInputStream
方法名:<init>
[英]Create a SharedByteArrayInputStream representing the entire byte array.
[中]创建一个表示整个字节数组的SharedByteArrayInputStream。
代码示例来源:origin: camunda/camunda-bpm-platform
public InputStream toStream() {
return new SharedByteArrayInputStream(buf, 0, count);
}
}
代码示例来源:origin: com.sun.mail/javax.mail
public InputStream toStream() {
return new SharedByteArrayInputStream(buf, 0, count);
}
}
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* Return an InputStream for the data.
* Note that a new stream is returned each time
* this method is called.
*
* @return the InputStream
* @exception IOException if no data has been set
*/
public InputStream getInputStream() throws IOException {
if (data == null)
throw new IOException("no data");
if (len < 0)
len = data.length;
return new SharedByteArrayInputStream(data, 0, len);
}
代码示例来源:origin: com.sun.mail/javax.mail
/**
* Return an InputStream for the data.
* Note that a new stream is returned each time
* this method is called.
*
* @return the InputStream
* @exception IOException if no data has been set
*/
@Override
public InputStream getInputStream() throws IOException {
if (data == null)
throw new IOException("no data");
if (len < 0)
len = data.length;
return new SharedByteArrayInputStream(data, 0, len);
}
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* Return a new InputStream representing a subset of the data
* from this InputStream, starting at <code>start</code> (inclusive)
* up to <code>end</code> (exclusive). <code>start</code> must be
* non-negative. If <code>end</code> is -1, the new stream ends
* at the same place as this stream. The returned InputStream
* will also implement the SharedInputStream interface.
*
* @param start the starting position
* @param end the ending position + 1
* @return the new stream
*/
public InputStream newStream(long start, long end) {
if (start < 0)
throw new IllegalArgumentException("start < 0");
if (end == -1)
end = count - this.start;
return new SharedByteArrayInputStream(buf,
this.start + (int)start, (int)(end - start));
}
}
代码示例来源:origin: com.sun.mail/javax.mail
/**
* Return a new InputStream representing a subset of the data
* from this InputStream, starting at <code>start</code> (inclusive)
* up to <code>end</code> (exclusive). <code>start</code> must be
* non-negative. If <code>end</code> is -1, the new stream ends
* at the same place as this stream. The returned InputStream
* will also implement the SharedInputStream interface.
*
* @param start the starting position
* @param end the ending position + 1
* @return the new stream
*/
@Override
public InputStream newStream(long start, long end) {
if (start < 0)
throw new IllegalArgumentException("start < 0");
if (end == -1)
end = count - this.start;
return new SharedByteArrayInputStream(buf,
this.start + (int)start, (int)(end - start));
}
}
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* Produce the raw bytes of the content. This method is used during
* parsing, to create a DataHandler object for the content. Subclasses
* that can provide a separate input stream for just the message
* content might want to override this method. <p>
*
* This implementation returns a SharedInputStream, if
* <code>contentStream</code> is not null. Otherwise, it
* returns a ByteArrayInputStream constructed
* out of the <code>content</code> byte array.
*
* @return an InputStream containing the raw bytes
* @exception MessagingException for failures
* @see #content
*/
protected InputStream getContentStream() throws MessagingException {
if (contentStream != null)
return ((SharedInputStream)contentStream).newStream(0, -1);
if (content != null)
return new SharedByteArrayInputStream(content);
throw new MessagingException("No MimeMessage content");
}
代码示例来源:origin: com.sun.mail/javax.mail
/**
* Produce the raw bytes of the content. This method is used during
* parsing, to create a DataHandler object for the content. Subclasses
* that can provide a separate input stream for just the message
* content might want to override this method. <p>
*
* This implementation returns a SharedInputStream, if
* <code>contentStream</code> is not null. Otherwise, it
* returns a ByteArrayInputStream constructed
* out of the <code>content</code> byte array.
*
* @return an InputStream containing the raw bytes
* @exception MessagingException for failures
* @see #content
*/
protected InputStream getContentStream() throws MessagingException {
if (contentStream != null)
return ((SharedInputStream)contentStream).newStream(0, -1);
if (content != null)
return new SharedByteArrayInputStream(content);
throw new MessagingException("No MimeMessage content");
}
代码示例来源:origin: camunda/camunda-bpm-platform
bos.close();
SharedByteArrayInputStream bis =
new SharedByteArrayInputStream(bos.toByteArray());
parse(bis);
bis.close();
代码示例来源:origin: com.sun.mail/javax.mail
bos.close();
SharedByteArrayInputStream bis =
new SharedByteArrayInputStream(bos.toByteArray());
parse(bis);
bis.close();
代码示例来源:origin: com.sun.mail/mailapi
public InputStream toStream() {
return new SharedByteArrayInputStream(buf, 0, count);
}
}
代码示例来源:origin: org.glassfish.metro/webservices-extra
public InputStream toStream() {
return new SharedByteArrayInputStream(buf, 0, count);
}
}
代码示例来源:origin: apache/james-project
public static SharedByteArrayInputStream getSystemResourceAsSharedStream(String filename) {
return new SharedByteArrayInputStream(getSystemResourceAsByteArray(filename));
}
}
代码示例来源:origin: mguessan/davmail
/**
* Send message.
*
* @param messageBody MIME message body
* @throws IOException on error
*/
public void sendMessage(byte[] messageBody) throws IOException {
try {
sendMessage(new MimeMessage(null, new SharedByteArrayInputStream(messageBody)));
} catch (MessagingException e) {
throw new IOException(e.getMessage());
}
}
代码示例来源:origin: org.apache.james/james-server-util
public static SharedByteArrayInputStream getSystemResourceAsSharedStream(String filename) {
return new SharedByteArrayInputStream(getSystemResourceAsByteArray(filename));
}
}
代码示例来源:origin: org.apache.james/james-server-queue-jms
public MimeMessageObjectMessageSource(ObjectMessage message) throws JMSException {
this.message = message;
this.id = message.getJMSMessageID();
this.content = (byte[]) message.getObject();
in = new SharedByteArrayInputStream(content);
}
代码示例来源:origin: org.apache.james/apache-james-mailbox-store
private static SharedByteArrayInputStream copyFullContent(MailboxMessage original) throws MailboxException {
try {
return new SharedByteArrayInputStream(IOUtils.toByteArray(original.getFullContent()));
} catch (IOException e) {
throw new MailboxException("Unable to parse message", e);
}
}
代码示例来源:origin: org.apache.james/apache-james-mailbox-jpa
/**
* Create a copy of the given message
*/
public JPAStreamingMailboxMessage(JPAMailbox mailbox, MessageUid uid, long modSeq, MailboxMessage message) throws MailboxException {
super(mailbox, uid, modSeq, message);
try {
this.content = new SharedByteArrayInputStream(IOUtils.toByteArray(message.getFullContent()));
this.header = getHeaderContent();
this.body = getBodyContent();
} catch (IOException e) {
throw new MailboxException("Unable to parse message",e);
}
}
代码示例来源:origin: org.apache.james/apache-james-mailbox-spamassassin
private SimpleMailboxMessage createMessage(MailboxId mailboxId) {
int size = 45;
int bodyStartOctet = 25;
byte[] content = "Subject: test\r\n\r\nBody\r\n".getBytes(StandardCharsets.UTF_8);
return new SimpleMailboxMessage(TestMessageId.of(58), new Date(),
size, bodyStartOctet, new SharedByteArrayInputStream(content), new Flags(), new PropertyBuilder(),
mailboxId);
}
}
代码示例来源:origin: org.apache.james/apache-james-mailbox-cassandra
private SimpleMailboxMessage createMessage(MessageId messageId, String content, int bodyStart, PropertyBuilder propertyBuilder, Collection<MessageAttachment> attachments) {
return SimpleMailboxMessage.builder()
.messageId(messageId)
.mailboxId(MAILBOX_ID)
.uid(messageUid)
.internalDate(new Date())
.bodyStartOctet(bodyStart)
.size(content.length())
.content(new SharedByteArrayInputStream(content.getBytes(StandardCharsets.UTF_8)))
.flags(new Flags())
.propertyBuilder(propertyBuilder)
.addAttachments(attachments)
.build();
}
内容来源于网络,如有侵权,请联系作者删除!