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