FileDocCategorySizeDatePackage
NBA.javaAPI DocJMF 2.1.1e2291Mon May 12 12:20:50 BST 2003com.sun.media

NBA

public final class NBA extends Object

Fields Summary
private long
data
private int
size
private Class
type
private Object
javaData
private int
atype
Constructors Summary
public NBA(Class type, int size)


     
	try {
	    JMFSecurityManager.loadLibrary( "jmutil");
	} catch (Throwable t) {
	}
    
	this.type = type;
	this.size = size;
	if (type == short[].class) {
	    atype = 2;
	    size *= 2;
	} else if (type == int[].class) {
	    atype = 4;
	    size *= 4;
	} else if (type == long[].class) {
	    atype = 8;
	    size *= 8;
	}
	
	//System.err.println("NBA.constructor allocating " + size);
	data = nAllocate(size);
	if (data == 0)
	    throw new OutOfMemoryError("Couldn't allocate native buffer");
    
Methods Summary
public synchronized java.lang.Objectclone()

	NBA cl = new NBA(type, size);
	nCopyToNative(data, cl.data, size);
	return cl;
    
public synchronized voidcopyTo(com.sun.media.NBA nba)

	if (nba.size >= size) {
	    nCopyToNative(data, nba.data, size);
	}
    
public synchronized voidcopyTo(byte[] javadata)

	if (javadata.length >= size) {
	    nCopyToJava(data, javadata, size, atype);
	}
    
protected final synchronized voidfinalize()

	if (data != 0)
	    nDeallocate(data);
	data = 0;
    
public synchronized java.lang.ObjectgetData()

	if (javaData == null) {
	    if (type == byte[].class)
		javaData = new byte[size];
	    else if (type == short[].class)
		javaData = new short[size];
	    else if (type == int[].class)
		javaData = new int[size];
	    else if (type == long[].class)
		javaData = new long[size];
	    else {
		System.err.println("NBA: Don't handle this data type");
		return null;
	    }
	}
	//Thread.dumpStack();
	//System.err.println("NBA.getData");
	nCopyToJava(data, javaData, size, atype);
	return javaData;
    
public synchronized longgetNativeData()

	return data;
    
public intgetSize()

	return size;
    
private native longnAllocate(int size)

private native voidnCopyToJava(long indata, java.lang.Object outdata, int size, int atype)

private native voidnCopyToNative(long indata, long outdata, int size)

private native voidnDeallocate(long data)