本文整理汇总了Java中com.sun.xml.internal.ws.developer.StreamingDataHandler类的典型用法代码示例。如果您正苦于以下问题:Java StreamingDataHandler类的具体用法?Java StreamingDataHandler怎么用?Java StreamingDataHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StreamingDataHandler类属于com.sun.xml.internal.ws.developer包,在下文中一共展示了StreamingDataHandler类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeNonMtomAttachments
import com.sun.xml.internal.ws.developer.StreamingDataHandler; //导入依赖的package包/类
@SuppressWarnings("resource")
private void writeNonMtomAttachments(AttachmentSet attachments,
OutputStream out, String boundary) throws IOException {
for (Attachment att : attachments) {
DataHandler dh = att.asDataHandler();
if (dh instanceof StreamingDataHandler) {
StreamingDataHandler sdh = (StreamingDataHandler) dh;
// If DataHandler has href Content-ID, it is MTOM, so skip.
if (sdh.getHrefCid() != null)
continue;
}
// build attachment frame
writeln("--" + boundary, out);
writeMimeHeaders(att.getContentType(), att.getContentId(), out);
att.writeTo(out);
writeln(out); // write \r\n
}
}
示例2: addBinaryText
import com.sun.xml.internal.ws.developer.StreamingDataHandler; //导入依赖的package包/类
private String addBinaryText(DataHandler data) {
String hrefOrCid = null;
if (data instanceof StreamingDataHandler) {
hrefOrCid = ((StreamingDataHandler) data).getHrefCid();
}
if (hrefOrCid == null) hrefOrCid = encodeCid();
String prefixedCid = (hrefOrCid.startsWith("cid:")) ? hrefOrCid : "cid:" + hrefOrCid;
// Should we do the threshold processing on DataHandler ? But that would be
// expensive as DataHolder need to read the data again from its source
//binaryText = BinaryTextImpl.createBinaryTextFromDataHandler((MessageImpl) soap, prefixedCid, currentElement.getOwnerDocument(), data);
//currentElement.appendChild(binaryText);
if (currentElement instanceof MtomEnabled) {
binaryText = ((MtomEnabled) currentElement).addBinaryText(prefixedCid, data);
} else {
throw new IllegalStateException("The currentElement is not MtomEnabled " + currentElement);
}
return hrefOrCid;
}
示例3: ByteArrayBuffer
import com.sun.xml.internal.ws.developer.StreamingDataHandler; //导入依赖的package包/类
ByteArrayBuffer(@NotNull DataHandler dh, String b) {
this.dh = dh;
String cid = null;
if (dh instanceof StreamingDataHandler) {
StreamingDataHandler sdh = (StreamingDataHandler) dh;
if (sdh.getHrefCid() != null)
cid = sdh.getHrefCid();
}
this.contentId = cid != null ? cid : encodeCid();
boundary = b;
}
示例4: next
import com.sun.xml.internal.ws.developer.StreamingDataHandler; //导入依赖的package包/类
@Override
public int next() throws XMLStreamException {
int event = reader.next();
if (event == XMLStreamConstants.START_ELEMENT && reader.getLocalName().equals(XOP_LOCALNAME) && reader.getNamespaceURI().equals(XOP_NAMESPACEURI)) {
//its xop reference, take the URI reference
String href = reader.getAttributeValue(null, "href");
try {
xopHref = href;
Attachment att = getAttachment(href);
if(att != null){
DataHandler dh = att.asDataHandler();
if (dh instanceof StreamingDataHandler) {
((StreamingDataHandler)dh).setHrefCid(att.getContentId());
}
base64AttData = new Base64Data();
base64AttData.set(dh);
}
xopReferencePresent = true;
} catch (IOException e) {
throw new WebServiceException(e);
}
//move to the </xop:Include>
XMLStreamReaderUtil.nextElementContent(reader);
return XMLStreamConstants.CHARACTERS;
}
if(xopReferencePresent){
xopReferencePresent = false;
base64EncodedText = null;
xopHref = null;
}
return event;
}