本文整理汇总了Java中org.apache.mina.core.buffer.IoBuffer.getString方法的典型用法代码示例。如果您正苦于以下问题:Java IoBuffer.getString方法的具体用法?Java IoBuffer.getString怎么用?Java IoBuffer.getString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.mina.core.buffer.IoBuffer
的用法示例。
在下文中一共展示了IoBuffer.getString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: decodeProperties
import org.apache.mina.core.buffer.IoBuffer; //导入方法依赖的package包/类
private Map<String, String> decodeProperties ( final IoSession session, final IoBuffer data ) throws CharacterCodingException
{
final int count = data.getInt ();
final Map<String, String> result = new HashMap<String, String> ( count );
final CharsetDecoder decoder = getCharsetDecoder ( session );
for ( int i = 0; i < count; i++ )
{
final String key = data.getString ( decoder );
final String value = data.getString ( decoder );
result.put ( key, value );
}
return result;
}
示例2: get
import org.apache.mina.core.buffer.IoBuffer; //导入方法依赖的package包/类
@Override
public String get ( final IoBuffer data, final int index )
{
try
{
return data.getString ( this.length, this.charset.newDecoder () );
}
catch ( final CharacterCodingException e )
{
throw new RuntimeException ( e );
}
}
示例3: decodeCloseFrame
import org.apache.mina.core.buffer.IoBuffer; //导入方法依赖的package包/类
private CloseMessage decodeCloseFrame ( final IoSession session, final IoBuffer data ) throws CharacterCodingException
{
return new CloseMessage ( data.getString ( getCharsetDecoder ( session ) ), data.getInt () );
}