当前位置: 首页>>代码示例>>Java>>正文


Java Buffer.ascii方法代码示例

本文整理汇总了Java中org.fusesource.hawtbuf.Buffer.ascii方法的典型用法代码示例。如果您正苦于以下问题:Java Buffer.ascii方法的具体用法?Java Buffer.ascii怎么用?Java Buffer.ascii使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.fusesource.hawtbuf.Buffer的用法示例。


在下文中一共展示了Buffer.ascii方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testFlush

import org.fusesource.hawtbuf.Buffer; //导入方法依赖的package包/类
@Test
public void testFlush() throws Exception {
	final Buffer value = Buffer.ascii("TESTDATA");
	codec.write(value);
	final int bytesThatWillBeWritten = value.length();
	expect(writableByteChannel.write((ByteBuffer) anyObject())).andAnswer(createWriteAnswer(bytesThatWillBeWritten));
	replay(writableByteChannel);

	final BufferState state = codec.flush();

	assertEquals(BufferState.EMPTY, state);
	assertEquals(false, codec.full());
	assertEquals(true, codec.empty());
	assertEquals(bytesThatWillBeWritten, codec.getWriteCounter());

	assertEquals(BufferState.WAS_EMPTY, codec.flush());
}
 
开发者ID:apache,项目名称:aries-rsa,代码行数:18,代码来源:LengthPrefixedCodecTest.java

示例2: testWrite

import org.fusesource.hawtbuf.Buffer; //导入方法依赖的package包/类
@Test
public void testWrite() throws Exception {
	final Buffer value = Buffer.ascii("TESTDATA");

	final BufferState state = codec.write(value);

	assertEquals(BufferState.WAS_EMPTY, state);
	assertEquals(false, codec.full());
	assertEquals(false, codec.empty());
	assertEquals(0l, codec.getWriteCounter());
}
 
开发者ID:apache,项目名称:aries-rsa,代码行数:12,代码来源:LengthPrefixedCodecTest.java

示例3:

import org.fusesource.hawtbuf.Buffer; //导入方法依赖的package包/类
@Test
public void testWrite$Twice() throws Exception {
	final Buffer value1 = Buffer.ascii("TESTDATA");
	final Buffer value2 = Buffer.ascii("TESTDATA");
	codec.write(value1);

	final BufferState state = codec.write(value2);

	assertEquals(BufferState.NOT_EMPTY, state);
	assertEquals(false, codec.full());
	assertEquals(false, codec.empty());
	assertEquals(0l, codec.getWriteCounter());
}
 
开发者ID:apache,项目名称:aries-rsa,代码行数:14,代码来源:LengthPrefixedCodecTest.java

示例4: anyObject

import org.fusesource.hawtbuf.Buffer; //导入方法依赖的package包/类
@Test
public void testFlush$Partially() throws Exception {
	final Buffer value = Buffer.ascii("TESTDATA");
	codec.write(value);
	final int bytesThatWillBeWritten = value.length() / 2;
	expect(writableByteChannel.write((ByteBuffer) anyObject())).andAnswer(createWriteAnswer(bytesThatWillBeWritten));
	replay(writableByteChannel);

	final BufferState state = codec.flush();

	assertEquals(BufferState.NOT_EMPTY, state);
	assertEquals(false, codec.full());
	assertEquals(false, codec.empty());
	assertEquals(bytesThatWillBeWritten, codec.getWriteCounter());
}
 
开发者ID:apache,项目名称:aries-rsa,代码行数:16,代码来源:LengthPrefixedCodecTest.java

示例5: toAsciiBuffer

import org.fusesource.hawtbuf.Buffer; //导入方法依赖的package包/类
public static AsciiBuffer toAsciiBuffer(Buffer value) {
    return value.ascii();
}
 
开发者ID:christian-posta,项目名称:activemq-apollo-java-port,代码行数:4,代码来源:BufferConversions.java


注:本文中的org.fusesource.hawtbuf.Buffer.ascii方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。