本文整理汇总了Java中org.fusesource.hawtbuf.Buffer.length方法的典型用法代码示例。如果您正苦于以下问题:Java Buffer.length方法的具体用法?Java Buffer.length怎么用?Java Buffer.length使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.fusesource.hawtbuf.Buffer
的用法示例。
在下文中一共展示了Buffer.length方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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());
}
示例3: setBuffer
import org.fusesource.hawtbuf.Buffer; //导入方法依赖的package包/类
public void setBuffer(Buffer value) {
if( !value.startsWith(PREFIX) || value.length()!=8 ) {
throw new IllegalArgumentException("Not an AMQP header buffer");
}
buffer = value.buffer();
}
示例4: setBuffer
import org.fusesource.hawtbuf.Buffer; //导入方法依赖的package包/类
public void setBuffer(Buffer value, boolean validate) {
if (validate && !value.startsWith(PREFIX) || value.length() != 8) {
throw new IllegalArgumentException("Not an AMQP header buffer");
}
buffer = value.buffer();
}