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


Java CBUtil.writeString方法代码示例

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


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

示例1: encode

import org.apache.cassandra.transport.CBUtil; //导入方法依赖的package包/类
public void encode(ErrorMessage msg, ByteBuf dest, int version)
{
    dest.writeInt(msg.error.code().value);
    CBUtil.writeString(msg.error.getMessage(), dest);

    switch (msg.error.code())
    {
        case UNAVAILABLE:
            UnavailableException ue = (UnavailableException)msg.error;
            CBUtil.writeConsistencyLevel(ue.consistency, dest);
            dest.writeInt(ue.required);
            dest.writeInt(ue.alive);
            break;
        case WRITE_TIMEOUT:
        case READ_TIMEOUT:
            RequestTimeoutException rte = (RequestTimeoutException)msg.error;
            boolean isWrite = msg.error.code() == ExceptionCode.WRITE_TIMEOUT;

            CBUtil.writeConsistencyLevel(rte.consistency, dest);
            dest.writeInt(rte.received);
            dest.writeInt(rte.blockFor);
            if (isWrite)
                CBUtil.writeString(((WriteTimeoutException)rte).writeType.toString(), dest);
            else
                dest.writeByte((byte)(((ReadTimeoutException)rte).dataPresent ? 1 : 0));
            break;
        case UNPREPARED:
            PreparedQueryNotFoundException pqnfe = (PreparedQueryNotFoundException)msg.error;
            CBUtil.writeBytes(pqnfe.id.bytes, dest);
            break;
        case ALREADY_EXISTS:
            AlreadyExistsException aee = (AlreadyExistsException)msg.error;
            CBUtil.writeString(aee.ksName, dest);
            CBUtil.writeString(aee.cfName, dest);
            break;
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:38,代码来源:ErrorMessage.java

示例2: encode

import org.apache.cassandra.transport.CBUtil; //导入方法依赖的package包/类
public void encode(ErrorMessage msg, ChannelBuffer dest, int version)
{
    dest.writeInt(msg.error.code().value);
    CBUtil.writeString(msg.error.getMessage(), dest);

    switch (msg.error.code())
    {
        case UNAVAILABLE:
            UnavailableException ue = (UnavailableException)msg.error;
            CBUtil.writeConsistencyLevel(ue.consistency, dest);
            dest.writeInt(ue.required);
            dest.writeInt(ue.alive);
            break;
        case WRITE_TIMEOUT:
        case READ_TIMEOUT:
            RequestTimeoutException rte = (RequestTimeoutException)msg.error;
            boolean isWrite = msg.error.code() == ExceptionCode.WRITE_TIMEOUT;

            CBUtil.writeConsistencyLevel(rte.consistency, dest);
            dest.writeInt(rte.received);
            dest.writeInt(rte.blockFor);
            if (isWrite)
                CBUtil.writeString(((WriteTimeoutException)rte).writeType.toString(), dest);
            else
                dest.writeByte((byte)(((ReadTimeoutException)rte).dataPresent ? 1 : 0));
            break;
        case UNPREPARED:
            PreparedQueryNotFoundException pqnfe = (PreparedQueryNotFoundException)msg.error;
            CBUtil.writeBytes(pqnfe.id.bytes, dest);
            break;
        case ALREADY_EXISTS:
            AlreadyExistsException aee = (AlreadyExistsException)msg.error;
            CBUtil.writeString(aee.ksName, dest);
            CBUtil.writeString(aee.cfName, dest);
            break;
    }
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:38,代码来源:ErrorMessage.java

示例3: encode

import org.apache.cassandra.transport.CBUtil; //导入方法依赖的package包/类
public void encode(AuthenticateMessage msg, ByteBuf dest, int version)
{
    CBUtil.writeString(msg.authenticator, dest);
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:5,代码来源:AuthenticateMessage.java

示例4: encode

import org.apache.cassandra.transport.CBUtil; //导入方法依赖的package包/类
public void encode(AuthenticateMessage msg, ChannelBuffer dest, int version)
{
    CBUtil.writeString(msg.authenticator, dest);
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:5,代码来源:AuthenticateMessage.java


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