• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Base64Data类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.sun.xml.internal.bind.v2.runtime.unmarshaller.Base64Data的典型用法代码示例。如果您正苦于以下问题:Java Base64Data类的具体用法?Java Base64Data怎么用?Java Base64Data使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Base64Data类属于com.sun.xml.internal.bind.v2.runtime.unmarshaller包,在下文中一共展示了Base64Data类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: text

import com.sun.xml.internal.bind.v2.runtime.unmarshaller.Base64Data; //导入依赖的package包/类
public void text( Pcdata value, boolean needsSeparatingWhitespace ) throws IOException, SAXException, XMLStreamException {
    if(value instanceof Base64Data && !serializer.getInlineBinaryFlag()) {
        Base64Data b64d = (Base64Data) value;
        String cid;
        if(b64d.hasData())
            cid = serializer.attachmentMarshaller.addMtomAttachment(
                            b64d.get(),0,b64d.getDataLen(),b64d.getMimeType(),nsUri,localName);
        else
            cid = serializer.attachmentMarshaller.addMtomAttachment(
                b64d.getDataHandler(),nsUri,localName);

        if(cid!=null) {
            nsContext.getCurrent().push();
            int prefix = nsContext.declareNsUri(WellKnownNamespace.XOP,"xop",false);
            beginStartTag(prefix,"Include");
            attribute(-1,"href",cid);
            endStartTag();
            endTag(prefix,"Include");
            nsContext.getCurrent().pop();
            return;
        }
    }
    next.text(value, needsSeparatingWhitespace);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:MTOMXmlOutput.java


示例2: text

import com.sun.xml.internal.bind.v2.runtime.unmarshaller.Base64Data; //导入依赖的package包/类
@Override
public void text(Pcdata value, boolean needsSeparatingWhitespace) throws IOException {
    if (needsSeparatingWhitespace)
        fiout.writeLowLevelText(" ");

    /*
     * Check if the CharSequence is from a base64Binary data type
     */
    if (!(value instanceof Base64Data)) {
        final int len = value.length();
        if(len <buf.length) {
            value.writeTo(buf, 0);
            fiout.writeLowLevelText(buf, len);
        } else {
            fiout.writeLowLevelText(value.toString());
        }
    } else {
        final Base64Data dataValue = (Base64Data)value;
        // Write out the octets using the base64 encoding algorithm
        fiout.writeLowLevelOctets(dataValue.get(), dataValue.getDataLen());
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:23,代码来源:FastInfosetStreamWriterOutput.java


示例3: parse

import com.sun.xml.internal.bind.v2.runtime.unmarshaller.Base64Data; //导入依赖的package包/类
public Image parse(CharSequence text) throws SAXException  {
    try {
        InputStream is;
        if(text instanceof Base64Data)
            is = ((Base64Data)text).getInputStream();
        else
            is = new ByteArrayInputStream(decodeBase64(text)); // TODO: buffering is inefficient

        // technically we should check the MIME type here, but
        // normally images can be content-sniffed.
        // so the MIME type check will only make us slower and draconian, both of which
        // JAXB 2.0 isn't interested.
        try {
            return ImageIO.read(is);
        } finally {
            is.close();
        }
    } catch (IOException e) {
        UnmarshallingContext.getInstance().handleError(e);
        return null;
    }
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:23,代码来源:RuntimeBuiltinLeafInfoImpl.java


示例4: print

import com.sun.xml.internal.bind.v2.runtime.unmarshaller.Base64Data; //导入依赖的package包/类
public Base64Data print(Image v) {
    ByteArrayOutputStreamEx imageData = new ByteArrayOutputStreamEx();
    XMLSerializer xs = XMLSerializer.getInstance();

    String mimeType = xs.getXMIMEContentType();
    if(mimeType==null || mimeType.startsWith("image/*"))
        // because PNG is lossless, it's a good default
        //
        // mime type can be a range, in which case we can't just pass that
        // to ImageIO.getImageWritersByMIMEType, so here I'm just assuming
        // the default of PNG. Not sure if this is complete.
        mimeType = "image/png";

    try {
        Iterator<ImageWriter> itr = ImageIO.getImageWritersByMIMEType(mimeType);
        if(itr.hasNext()) {
            ImageWriter w = itr.next();
            ImageOutputStream os = ImageIO.createImageOutputStream(imageData);
            w.setOutput(os);
            w.write(convertToBufferedImage(v));
            os.close();
            w.dispose();
        } else {
            // no encoder
            xs.handleEvent(new ValidationEventImpl(
                ValidationEvent.ERROR,
                Messages.NO_IMAGE_WRITER.format(mimeType),
                xs.getCurrentLocation(null) ));
            // TODO: proper error reporting
            throw new RuntimeException("no encoder for MIME type "+mimeType);
        }
    } catch (IOException e) {
        xs.handleError(e);
        // TODO: proper error reporting
        throw new RuntimeException(e);
    }
    Base64Data bd = new Base64Data();
    imageData.set(bd,mimeType);
    return bd;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:41,代码来源:RuntimeBuiltinLeafInfoImpl.java


示例5: parse

import com.sun.xml.internal.bind.v2.runtime.unmarshaller.Base64Data; //导入依赖的package包/类
public DataHandler parse(CharSequence text) {
    if(text instanceof Base64Data)
        return ((Base64Data)text).getDataHandler();
    else
        return new DataHandler(new ByteArrayDataSource(decodeBase64(text),
            UnmarshallingContext.getInstance().getXMIMEContentType()));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:RuntimeBuiltinLeafInfoImpl.java


示例6: decodeBase64

import com.sun.xml.internal.bind.v2.runtime.unmarshaller.Base64Data; //导入依赖的package包/类
private static byte[] decodeBase64(CharSequence text) {
    if (text instanceof Base64Data) {
        Base64Data base64Data = (Base64Data) text;
        return base64Data.getExact();
    } else {
        return DatatypeConverterImpl._parseBase64Binary(text.toString());
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:RuntimeBuiltinLeafInfoImpl.java


示例7: text

import com.sun.xml.internal.bind.v2.runtime.unmarshaller.Base64Data; //导入依赖的package包/类
public void text(Pcdata value, boolean needsSeparatingWhitespace) throws XMLStreamException {
    if(needsSeparatingWhitespace) {
        out.writeCharacters(" ");
    }

    if (!(value instanceof Base64Data)) {
        out.writeCharacters(value.toString());
    } else {
        Base64Data v = (Base64Data)value;
        out.writeBinary(v.getDataHandler());
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:StAXExStreamWriterOutput.java



注:本文中的com.sun.xml.internal.bind.v2.runtime.unmarshaller.Base64Data类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java LoginService类代码示例发布时间:2022-05-23
下一篇:
Java UIManager类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap