All Downloads are FREE. Search and download functionalities are using the official Maven repository.

java.nio.internal.BufferInternalUtils Maven / Gradle / Ivy

Go to download

JVM AOT compiler currently generating JavaScript, C++, Haxe, with initial focus on Kotlin and games.

There is a newer version: 0.6.8
Show newest version
package java.nio.internal;

import java.nio.Buffer;
import java.nio.ByteBuffer;

@SuppressWarnings("unused")
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();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy