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

com.jtransc.io.ra.RAByteArray 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 com.jtransc.io.ra;

public class RAByteArray extends RAStream {
	byte[] data;

	public RAByteArray(byte[] data) {
		this.data = data;
	}

	@Override
	public void setLength(long length) {
		throw new UnsupportedOperationException();
	}

	@Override
	public long getLength() {
		return data.length;
	}

	@Override
	protected int read(long position, byte[] ref, int pos, int len) {
		long epos = Math.min(data.length, position + len);
		int finalLen = (int)(epos - position);
		System.arraycopy(data, (int) position, ref, pos, finalLen);
		return finalLen;
	}

	@Override
	protected void write(long position, byte[] ref, int pos, int len) {
		throw new UnsupportedOperationException();
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy