本文整理汇总了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());
}
示例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());
}
示例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());
}
示例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());
}
示例5: toAsciiBuffer
import org.fusesource.hawtbuf.Buffer; //导入方法依赖的package包/类
public static AsciiBuffer toAsciiBuffer(Buffer value) {
return value.ascii();
}