本文整理了Java中com.jogamp.common.nio.Buffers.copyShortBufferAsByteBuffer()
方法的一些代码示例,展示了Buffers.copyShortBufferAsByteBuffer()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Buffers.copyShortBufferAsByteBuffer()
方法的具体详情如下:
包路径:com.jogamp.common.nio.Buffers
类名称:Buffers
方法名:copyShortBufferAsByteBuffer
[英]Copies the remaining elements (as defined by limit() - position()
) in the passed ShortBuffer into a newly-allocated direct ByteBuffer. The returned buffer will have its byte order set to the host platform's native byte order. The position of the newly-allocated buffer will be zero, and the position of the passed buffer is unchanged.
[中]
代码示例来源:origin: ch.unibas.cs.gravis/scalismo-native-stub
/**
* Copies the <i>remaining</i> elements (as defined by
* <code>limit() - position()</code>) in the passed ShortBuffer
* into a newly-allocated direct ShortBuffer. The returned buffer
* will have its byte order set to the host platform's native byte
* order. The position of the newly-allocated buffer will be zero,
* and the position of the passed buffer is unchanged.
*/
public static ShortBuffer copyShortBuffer(final ShortBuffer orig) {
return copyShortBufferAsByteBuffer(orig).asShortBuffer();
}
代码示例来源:origin: org.jogamp.jogl/jogl-all-noawt
private final ByteBuffer copyToByteBuffer(Buffer buf) {
if (buf instanceof ByteBuffer) {
if (buf.position() == 0) {
return (ByteBuffer) buf;
}
return Buffers.copyByteBuffer((ByteBuffer) buf);
} else if (buf instanceof ShortBuffer) {
return Buffers.copyShortBufferAsByteBuffer((ShortBuffer) buf);
} else if (buf instanceof IntBuffer) {
return Buffers.copyIntBufferAsByteBuffer((IntBuffer) buf);
} else if (buf instanceof FloatBuffer) {
return Buffers.copyFloatBufferAsByteBuffer((FloatBuffer) buf);
} else {
throw new IllegalArgumentException("Unsupported buffer type (must be one of byte, short, int, or float)");
}
}
代码示例来源:origin: ch.unibas.cs.gravis/scalismo-native-stub
private final ByteBuffer copyToByteBuffer(Buffer buf) {
if (buf instanceof ByteBuffer) {
if (buf.position() == 0) {
return (ByteBuffer) buf;
}
return Buffers.copyByteBuffer((ByteBuffer) buf);
} else if (buf instanceof ShortBuffer) {
return Buffers.copyShortBufferAsByteBuffer((ShortBuffer) buf);
} else if (buf instanceof IntBuffer) {
return Buffers.copyIntBufferAsByteBuffer((IntBuffer) buf);
} else if (buf instanceof FloatBuffer) {
return Buffers.copyFloatBufferAsByteBuffer((FloatBuffer) buf);
} else {
throw new IllegalArgumentException("Unsupported buffer type (must be one of byte, short, int, or float)");
}
}
代码示例来源:origin: ch.unibas.cs.gravis/scalismo-native-stub
private final java.nio.ByteBuffer copyToByteBuffer(java.nio.Buffer buf) {
if (buf instanceof java.nio.ByteBuffer) {
if (buf.position() == 0) {
return (java.nio.ByteBuffer) buf;
}
return Buffers.copyByteBuffer((java.nio.ByteBuffer) buf);
} else if (buf instanceof java.nio.ShortBuffer) {
return Buffers.copyShortBufferAsByteBuffer((java.nio.ShortBuffer) buf);
} else if (buf instanceof java.nio.IntBuffer) {
return Buffers.copyIntBufferAsByteBuffer((java.nio.IntBuffer) buf);
} else if (buf instanceof java.nio.FloatBuffer) {
return Buffers.copyFloatBufferAsByteBuffer((java.nio.FloatBuffer) buf);
} else {
throw new IllegalArgumentException("Unsupported buffer type (must be one of byte, short, int, or float)");
}
}
代码示例来源:origin: org.jogamp.jogl/jogl-all-noawt
private final java.nio.ByteBuffer copyToByteBuffer(java.nio.Buffer buf) {
if (buf instanceof java.nio.ByteBuffer) {
if (buf.position() == 0) {
return (java.nio.ByteBuffer) buf;
}
return Buffers.copyByteBuffer((java.nio.ByteBuffer) buf);
} else if (buf instanceof java.nio.ShortBuffer) {
return Buffers.copyShortBufferAsByteBuffer((java.nio.ShortBuffer) buf);
} else if (buf instanceof java.nio.IntBuffer) {
return Buffers.copyIntBufferAsByteBuffer((java.nio.IntBuffer) buf);
} else if (buf instanceof java.nio.FloatBuffer) {
return Buffers.copyFloatBufferAsByteBuffer((java.nio.FloatBuffer) buf);
} else {
throw new IllegalArgumentException("Unsupported buffer type (must be one of byte, short, int, or float)");
}
}
内容来源于网络,如有侵权,请联系作者删除!