本文整理汇总了Java中com.sun.xml.internal.messaging.saaj.util.ByteOutputStream.getCount方法的典型用法代码示例。如果您正苦于以下问题:Java ByteOutputStream.getCount方法的具体用法?Java ByteOutputStream.getCount怎么用?Java ByteOutputStream.getCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.xml.internal.messaging.saaj.util.ByteOutputStream
的用法示例。
在下文中一共展示了ByteOutputStream.getCount方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: MimeBodyPart
import com.sun.xml.internal.messaging.saaj.util.ByteOutputStream; //导入方法依赖的package包/类
/**
* Constructs a MimeBodyPart by reading and parsing the data from
* the specified input stream. The parser consumes data till the end
* of the given input stream. The input stream must start at the
* beginning of a valid MIME body part and must terminate at the end
* of that body part. <p>
*
* Note that the "boundary" string that delimits body parts must
* <strong>not</strong> be included in the input stream. The intention
* is that the MimeMultipart parser will extract each body part's bytes
* from a multipart stream and feed them into this constructor, without
* the delimiter strings.
*
* @param is the body part Input Stream
*/
public MimeBodyPart(InputStream is) throws MessagingException {
if (!(is instanceof ByteArrayInputStream) &&
!(is instanceof BufferedInputStream) &&
!(is instanceof SharedInputStream))
is = new BufferedInputStream(is);
headers = new InternetHeaders(is);
if (is instanceof SharedInputStream) {
SharedInputStream sis = (SharedInputStream) is;
contentStream = sis.newStream(sis.getPosition(), -1);
} else {
try {
ByteOutputStream bos = new ByteOutputStream();
bos.write(is);
content = bos.getBytes();
contentLength = bos.getCount();
} catch (IOException ioex) {
throw new MessagingException("Error reading input stream", ioex);
}
}
}
示例2: setBase64Content
import com.sun.xml.internal.messaging.saaj.util.ByteOutputStream; //导入方法依赖的package包/类
public void setBase64Content(InputStream content, String contentType)
throws SOAPException {
if (mimePart != null) {
mimePart.close();
mimePart = null;
}
dataHandler = null;
InputStream decoded = null;
try {
decoded = MimeUtility.decode(content, "base64");
InternetHeaders hdrs = new InternetHeaders();
hdrs.setHeader("Content-Type", contentType);
//TODO: reading the entire attachment here is ineffcient. Somehow the MimeBodyPart
// Ctor with inputStream causes problems based on the InputStream
// has markSupported()==true
ByteOutputStream bos = new ByteOutputStream();
bos.write(decoded);
rawContent = new MimeBodyPart(hdrs, bos.getBytes(), bos.getCount());
setMimeHeader("Content-Type", contentType);
} catch (Exception e) {
log.log(Level.SEVERE, "SAAJ0578.soap.attachment.setbase64content.exception", e);
throw new SOAPExceptionImpl(e.getLocalizedMessage());
} finally {
try {
decoded.close();
} catch (IOException ex) {
throw new SOAPException(ex);
}
}
}
示例3: setRawContent
import com.sun.xml.internal.messaging.saaj.util.ByteOutputStream; //导入方法依赖的package包/类
public void setRawContent(InputStream content, String contentType)
throws SOAPException {
if (mimePart != null) {
mimePart.close();
mimePart = null;
}
dataHandler = null;
try {
InternetHeaders hdrs = new InternetHeaders();
hdrs.setHeader("Content-Type", contentType);
//TODO: reading the entire attachment here is ineffcient. Somehow the MimeBodyPart
// Ctor with inputStream causes problems based on whether the InputStream has
// markSupported()==true or false
ByteOutputStream bos = new ByteOutputStream();
bos.write(content);
rawContent = new MimeBodyPart(hdrs, bos.getBytes(), bos.getCount());
setMimeHeader("Content-Type", contentType);
} catch (Exception e) {
log.log(Level.SEVERE, "SAAJ0576.soap.attachment.setrawcontent.exception", e);
throw new SOAPExceptionImpl(e.getLocalizedMessage());
} finally {
try {
content.close();
} catch (IOException ex) {
throw new SOAPException(ex);
}
}
}
示例4: setBase64Content
import com.sun.xml.internal.messaging.saaj.util.ByteOutputStream; //导入方法依赖的package包/类
public void setBase64Content(InputStream content, String contentType)
throws SOAPException {
if (mimePart != null) {
mimePart.close();
mimePart = null;
}
dataHandler = null;
InputStream decoded = null;
try {
decoded = MimeUtility.decode(content, "base64");
InternetHeaders hdrs = new InternetHeaders();
hdrs.setHeader("Content-Type", contentType);
//TODO: reading the entire attachment here is ineffcient. Somehow the MimeBodyPart
// Ctor with inputStream causes problems based on the InputStream
// has markSupported()==true
ByteOutputStream bos = new ByteOutputStream();
bos.write(decoded);
rawContent = new MimeBodyPart(hdrs, bos.getBytes(), bos.getCount());
setMimeHeader("Content-Type", contentType);
} catch (Exception e) {
log.log(Level.SEVERE, "SAAJ0578.soap.attachment.setbase64content.exception", e);
throw new SOAPExceptionImpl(e.getLocalizedMessage());
} finally {
try {
decoded.close();
} catch (IOException ex) {
throw new SOAPException(ex);
}
}
}