当前位置: 首页>>代码示例>>Java>>正文


Java BinaryOutputArchive.writeBool方法代码示例

本文整理汇总了Java中org.apache.jute.BinaryOutputArchive.writeBool方法的典型用法代码示例。如果您正苦于以下问题:Java BinaryOutputArchive.writeBool方法的具体用法?Java BinaryOutputArchive.writeBool怎么用?Java BinaryOutputArchive.writeBool使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.jute.BinaryOutputArchive的用法示例。


在下文中一共展示了BinaryOutputArchive.writeBool方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createBB

import org.apache.jute.BinaryOutputArchive; //导入方法依赖的package包/类
public void createBB() {
    try {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        BinaryOutputArchive boa = BinaryOutputArchive.getArchive(baos);
        boa.writeInt(-1, "len"); // We'll fill this in later
        if (requestHeader != null) {
            requestHeader.serialize(boa, "header");
        }
        if (request instanceof ConnectRequest) {
            request.serialize(boa, "connect");
            // append "am-I-allowed-to-be-readonly" flag
            boa.writeBool(readOnly, "readOnly");
        } else if (request != null) {
            request.serialize(boa, "request");
        }
        baos.close();
        this.bb = ByteBuffer.wrap(baos.toByteArray());
        this.bb.putInt(this.bb.capacity() - 4);
        this.bb.rewind();
    } catch (IOException e) {
        LOG.warn("Ignoring unexpected exception", e);
    }
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:24,代码来源:ClientCnxn.java

示例2: Packet

import org.apache.jute.BinaryOutputArchive; //导入方法依赖的package包/类
Packet(RequestHeader requestHeader, ReplyHeader replyHeader,
       Record request, Record response,
       WatchRegistration watchRegistration, boolean readOnly) {

    this.requestHeader = requestHeader;
    this.replyHeader = replyHeader;
    this.request = request;
    this.response = response;

    try {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        BinaryOutputArchive boa = BinaryOutputArchive.getArchive(baos);
        boa.writeInt(-1, "len"); // We'll fill this in later
        if (requestHeader != null) {
            requestHeader.serialize(boa, "header");
        }
        if (request instanceof ConnectRequest) {
            request.serialize(boa, "connect");
            // append "am-I-allowed-to-be-readonly" flag
            boa.writeBool(readOnly, "readOnly");
        } else if (request != null) {
            request.serialize(boa, "request");
        }
        baos.close();
        this.bb = ByteBuffer.wrap(baos.toByteArray());
        this.bb.putInt(this.bb.capacity() - 4);
        this.bb.rewind();
    } catch (IOException e) {
        LOG.warn("Ignoring unexpected exception", e);
    }

    this.watchRegistration = watchRegistration;
}
 
开发者ID:gerritjvv,项目名称:bigstreams,代码行数:34,代码来源:ClientCnxn.java


注:本文中的org.apache.jute.BinaryOutputArchive.writeBool方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。