java.nio.internal.BufferInternalUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jtransc-rt Show documentation
Show all versions of jtransc-rt Show documentation
JVM AOT compiler currently generating JavaScript, C++, Haxe, with initial focus on Kotlin and games.
package java.nio.internal;
import java.nio.Buffer;
import java.nio.ByteBuffer;
public class BufferInternalUtils {
static public ByteBuffer getByteBuffer(Buffer buffer) {
if (buffer instanceof ByteBufferAs) return ((ByteBufferAs)buffer).getByteBuffer();
if (buffer instanceof ByteBuffer) return (ByteBuffer)buffer;
throw new RuntimeException("Buffer not uses a ByteBuffer internally");
}
static public byte[] getByteBufferByteArray(Buffer buffer) {
return getByteBuffer(buffer).array();
}
public static void reference() {
}
}