本文整理汇总了Java中java.nio.DoubleBuffer.rewind方法的典型用法代码示例。如果您正苦于以下问题:Java DoubleBuffer.rewind方法的具体用法?Java DoubleBuffer.rewind怎么用?Java DoubleBuffer.rewind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.nio.DoubleBuffer
的用法示例。
在下文中一共展示了DoubleBuffer.rewind方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readPcRasterMapValues
import java.nio.DoubleBuffer; //导入方法依赖的package包/类
public static synchronized void readPcRasterMapValues(Jep jep, String variableName, double[] dest) throws JepException {
String bufferName = "readPcRasterMapValues" + dest.length;
Map<Integer, DoubleBuffer> map = readPcRasterMapValuesBuffers.get(jep);
if (map == null) {
map = new HashMap<Integer, DoubleBuffer>();
readPcRasterMapValuesBuffers.put(jep, map);
}
DoubleBuffer buffer = map.get(dest.length);
if (buffer == null) {
buffer = buffers.get(dest.length);
if (buffer == null) {
buffer = createNativeDoubleBuffer(dest.length);
buffers.put(dest.length, buffer);
}
declareDoubleArray(jep, bufferName, buffer);
map.put(dest.length, buffer);
}
jep.eval(bufferName + "[:]=reshape(pcr2numpy(" + variableName + ", 1E31), " + dest.length + ')');
buffer.rewind();
buffer.get(dest);
}
示例2: clone
import java.nio.DoubleBuffer; //导入方法依赖的package包/类
/**
* Creates a new DoubleBuffer with the same contents as the given
* DoubleBuffer. The new DoubleBuffer is seperate from the old one and
* changes are not reflected across. If you want to reflect changes,
* consider using Buffer.duplicate().
*
* @param buf
* the DoubleBuffer to copy
* @return the copy
*/
public static DoubleBuffer clone(DoubleBuffer buf) {
if (buf == null) {
return null;
}
buf.rewind();
DoubleBuffer copy;
if (isDirect(buf)) {
copy = createDoubleBuffer(buf.limit());
} else {
copy = DoubleBuffer.allocate(buf.limit());
}
copy.put(buf);
return copy;
}
示例3: getCursorPos
import java.nio.DoubleBuffer; //导入方法依赖的package包/类
private Vector2f getCursorPos() {
DoubleBuffer xpos = BufferUtils.createDoubleBuffer(1);
DoubleBuffer ypos = BufferUtils.createDoubleBuffer(1);
xpos.rewind();
xpos.rewind();
GLFW.glfwGetCursorPos(window.windowID, xpos, ypos);
double x = xpos.get();
double y = ypos.get();
xpos.clear();
ypos.clear();
Vector2f result = new Vector2f((float) x, (float) y);
return result;
}
示例4: createDoubleBuffer
import java.nio.DoubleBuffer; //导入方法依赖的package包/类
/**
* Create a new DoubleBuffer of an appropriate size to hold the specified
* number of doubles only if the given buffer if not already the right size.
*
* @param buf
* the buffer to first check and rewind
* @param size
* number of doubles that need to be held by the newly created
* buffer
* @return the requested new DoubleBuffer
*/
public static DoubleBuffer createDoubleBuffer(DoubleBuffer buf, int size) {
if (buf != null && buf.limit() == size) {
buf.rewind();
return buf;
}
buf = createDoubleBuffer(size);
return buf;
}