本文整理汇总了Java中org.apache.mina.core.buffer.IoBuffer.putDouble方法的典型用法代码示例。如果您正苦于以下问题:Java IoBuffer.putDouble方法的具体用法?Java IoBuffer.putDouble怎么用?Java IoBuffer.putDouble使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.mina.core.buffer.IoBuffer
的用法示例。
在下文中一共展示了IoBuffer.putDouble方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: encodeDoubleCollection
import org.apache.mina.core.buffer.IoBuffer; //导入方法依赖的package包/类
@Override
public void encodeDoubleCollection ( final IoBuffer buffer, final byte fieldNumber, final Collection<Double> data ) throws Exception
{
buffer.put ( fieldNumber );
if ( data != null )
{
buffer.put ( TYPE_DOUBLE_LIST );
buffer.putInt ( data.size () );
for ( final Double entry : data )
{
buffer.putDouble ( entry );
}
}
else
{
buffer.put ( TYPE_NULL );
}
}
示例2: encodeDouble
import org.apache.mina.core.buffer.IoBuffer; //导入方法依赖的package包/类
@Override
public void encodeDouble ( final IoBuffer buffer, final byte fieldNumber, final Double data ) throws Exception
{
buffer.put ( fieldNumber );
if ( data != null )
{
buffer.put ( TYPE_DOUBLE );
buffer.putDouble ( data );
}
else
{
buffer.put ( TYPE_NULL );
}
}
示例3: encodePrimitiveDouble
import org.apache.mina.core.buffer.IoBuffer; //导入方法依赖的package包/类
@Override
public void encodePrimitiveDouble ( final IoBuffer buffer, final byte fieldNumber, final double data ) throws Exception
{
buffer.put ( fieldNumber );
buffer.put ( TYPE_DOUBLE );
buffer.putDouble ( data );
}
示例4: inlineEncodeVariant
import org.apache.mina.core.buffer.IoBuffer; //导入方法依赖的package包/类
private void inlineEncodeVariant ( final IoBuffer buffer, final Variant variant ) throws Exception
{
final VariantType type = variant.getType ();
buffer.putEnum ( type );
switch ( type )
{
case BOOLEAN:
buffer.put ( variant.asBoolean () ? (byte)0xFF : (byte)0x00 );
break;
case DOUBLE:
buffer.putDouble ( variant.asDouble () );
break;
case INT32:
buffer.putInt ( variant.asInteger () );
break;
case INT64:
buffer.putLong ( variant.asLong () );
break;
case STRING:
buffer.putPrefixedString ( variant.asString (), STRING_PREFIX_LEN, this.encoder );
break;
case NULL:
break;
case UNKNOWN:
break;
}
}
示例5: putValue
import org.apache.mina.core.buffer.IoBuffer; //导入方法依赖的package包/类
@Override
public void putValue ( final IoBuffer slice, final Variant value )
{
slice.putDouble ( makeValue ( value ) );
}
示例6: encodeVariant
import org.apache.mina.core.buffer.IoBuffer; //导入方法依赖的package包/类
private void encodeVariant ( final IoSession session, final IoBuffer data, final Variant value ) throws ProtocolCodecException
{
if ( value == null )
{
data.put ( DataType.DEAD.getDataType () ); // dead
}
else if ( value.isNull () )
{
data.put ( DataType.NULL.getDataType () );
}
else if ( value.isBoolean () )
{
data.put ( DataType.BOOLEAN.getDataType () );
data.put ( (byte) ( value.asBoolean () ? 0xFF : 0x00 ) );
}
else if ( value.isInteger () )
{
data.put ( DataType.INT32.getDataType () );
data.putInt ( value.asInteger ( null ) );
}
else if ( value.isLong () )
{
data.put ( DataType.INT64.getDataType () );
data.putLong ( value.asLong ( null ) );
}
else if ( value.isDouble () )
{
data.put ( DataType.DOUBLE.getDataType () );
data.putDouble ( value.asDouble ( null ) );
}
else if ( value.isString () )
{
data.put ( DataType.STRING.getDataType () );
try
{
data.putPrefixedString ( value.asString ( null ), Sessions.getCharsetEncoder ( session ) );
}
catch ( final CharacterCodingException e )
{
throw new ProtocolCodecException ( e );
}
}
}