本文整理汇总了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;
}
示例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 );
}
示例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 );
}
示例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;
}