本文整理了Java中org.glassfish.grizzly.Buffer.rewind()
方法的一些代码示例,展示了Buffer.rewind()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Buffer.rewind()
方法的具体详情如下:
包路径:org.glassfish.grizzly.Buffer
类名称:Buffer
方法名:rewind
[英]Rewinds this buffer. The position is set to zero and the mark is discarded.
Invoke this method before a sequence of channel-write or get operations, assuming that the limit has already been set appropriately. For example:
out.write(buf); // Write remaining data
buf.rewind(); // Rewind buffer
buf.get(array); // Copy data into array
[中]倒带这个缓冲区。该位置设置为零,标记被丢弃。
在通道写入或获取操作序列之前调用此方法,假设已正确设置限制。例如:
out.write(buf); // Write remaining data
buf.rewind(); // Rewind buffer
buf.get(array); // Copy data into array
代码示例来源:origin: org.shoal/shoal-gms-impl
@Override
public Buffer rewind() {
grizzlyBuffer.rewind();
return this;
}
代码示例来源:origin: org.glassfish.shoal/shoal-gms-impl
@Override
public Buffer rewind() {
grizzlyBuffer.rewind();
return this;
}
代码示例来源:origin: javaee/grizzly
@Test
public void testBufferSlice() {
Buffer b = mm.allocate(10);
b.putInt(1);
ByteBuffer bb = b.slice().toByteBuffer().slice();
bb.rewind();
bb.putInt(2);
b.rewind();
assertEquals(1, b.getInt());
}
内容来源于网络,如有侵权,请联系作者删除!