本文整理匯總了Java中java.nio.LongBuffer.position方法的典型用法代碼示例。如果您正苦於以下問題:Java LongBuffer.position方法的具體用法?Java LongBuffer.position怎麽用?Java LongBuffer.position使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.nio.LongBuffer
的用法示例。
在下文中一共展示了LongBuffer.position方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getCompressedCounts
import java.nio.LongBuffer; //導入方法依賴的package包/類
@Override
public long[] getCompressedCounts() {
LongBuffer buf = LongBuffer.allocate(200);
Simple64.compress(buf, counts, 0, counts.length);
long[] r = new long[buf.position()];
buf.flip();
buf.get(r);
return r;
}
示例2: getCompressedCounts
import java.nio.LongBuffer; //導入方法依賴的package包/類
@Override
public long[] getCompressedCounts() {
LongBuffer buf = LongBuffer.allocate(counts.length);
Simple64.compress(buf, counts, 0, counts.length);
long[] r = new long[buf.position()];
buf.flip();
buf.get(r);
return r;
}
示例3: copy
import java.nio.LongBuffer; //導入方法依賴的package包/類
public static void copy(LongBuffer src, LongBuffer dst) {
if (dst != null && !dst.isDirect()) {
int saved_position = dst.position();
dst.put(src);
dst.position(saved_position);
}
}
示例4: doWrap
import java.nio.LongBuffer; //導入方法依賴的package包/類
private static LongBuffer doWrap(LongBuffer buffer) {
LongBuffer direct_buffer = lookupBuffer(buffer);
direct_buffer.clear();
int saved_position = buffer.position();
direct_buffer.put(buffer);
buffer.position(saved_position);
direct_buffer.flip();
return direct_buffer;
}
示例5: skip_LongBuffer
import java.nio.LongBuffer; //導入方法依賴的package包/類
@Benchmark
public void skip_LongBuffer() {
LongBuffer longBuffer = _byteBuffer.asLongBuffer();
for (int i = 0; i < _byteBuffer.capacity() / 8; i++) {
if (shouldSkip(i)) {
longBuffer.position(longBuffer.position() + 1);
} else {
long value = longBuffer.get();
assertThat(value).isEqualTo(i);
}
}
_byteBuffer.rewind();
}
示例6: doNoCopyWrap
import java.nio.LongBuffer; //導入方法依賴的package包/類
private static LongBuffer doNoCopyWrap(LongBuffer buffer) {
LongBuffer direct_buffer = lookupBuffer(buffer);
direct_buffer.limit(buffer.limit());
direct_buffer.position(buffer.position());
return direct_buffer;
}