本文整理匯總了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;
}