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


Java IoBuffer.getEnumSetShort方法代码示例

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


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

示例1: processHello

import org.apache.mina.core.buffer.IoBuffer; //导入方法依赖的package包/类
private boolean processHello ( final IoSession session, final IoBuffer data, final ProtocolDecoderOutput out ) throws ProtocolCodecException
{
    final int len = messageLength ( data );
    if ( len < 0 )
    {
        return false;
    }

    final byte version = data.get ();
    if ( version != 0x01 )
    {
        throw new ProtocolCodecException ( String.format ( "Protocol version %s is unsupported", version ) );
    }

    final short nodeId = data.getShort ();
    final EnumSet<Hello.Features> features = data.getEnumSetShort ( Hello.Features.class );

    out.write ( new Hello ( nodeId, features ) );

    return true;
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:22,代码来源:ProtocolDecoderImpl.java

示例2: decodeDataUpdateEntry

import org.apache.mina.core.buffer.IoBuffer; //导入方法依赖的package包/类
private DataUpdate.Entry decodeDataUpdateEntry ( final IoBuffer data, final IoSession session ) throws ProtocolCodecException
{
    final int register = data.getUnsignedShort ();
    final byte missedUpdates = data.get ();
    final long timestamp = data.getLong ();
    final Set<DataUpdate.State> states = data.getEnumSetShort ( DataUpdate.State.class );

    final Variant value = decodeVariant ( session, data );

    return new DataUpdate.Entry ( register, value, timestamp, states, missedUpdates );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:12,代码来源:ProtocolDecoderImpl.java

示例3: decodeEnumSet

import org.apache.mina.core.buffer.IoBuffer; //导入方法依赖的package包/类
@Override
public <E extends Enum<E>> Set<E> decodeEnumSet ( final IoBuffer buffer, final Class<E> enumClazz ) throws Exception
{
    final byte type = checkType ( buffer, TYPE_ENUM_SET, true );
    if ( type == TYPE_NULL )
    {
        return null;
    }

    return buffer.getEnumSetShort ( enumClazz );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:12,代码来源:DefaultBinaryContext.java

示例4: processWelcome

import org.apache.mina.core.buffer.IoBuffer; //导入方法依赖的package包/类
private boolean processWelcome ( final IoSession session, final IoBuffer data, final ProtocolDecoderOutput out ) throws ProtocolCodecException
{
    final int len = messageLength ( data );
    if ( len < 0 )
    {
        return false;
    }

    final EnumSet<Welcome.Features> features = data.getEnumSetShort ( Welcome.Features.class );

    logger.debug ( "Features: {}", features );

    final CharsetDecoder decoder = this.defaultCharset.newDecoder ();

    final int count = data.getUnsignedShort ();
    final Map<String, String> properties = new HashMap<String, String> ( count );

    for ( int i = 0; i < count; i++ )
    {
        try
        {
            final String key = data.getPrefixedString ( decoder );
            final String value = data.getPrefixedString ( decoder );

            properties.put ( key, value );
        }
        catch ( final CharacterCodingException e )
        {
            throw new ProtocolCodecException ( e );
        }
    }

    if ( features.contains ( Welcome.Features.LITTLE_ENDIAN ) )
    {
        logger.info ( "Setting little endian" );
        Sessions.setLittleEndian ( session );
    }

    out.write ( new Welcome ( features, properties ) );

    return true;
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:43,代码来源:ProtocolDecoderImpl.java


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