Methods Summary |
---|
private native boolean | allocate(int size)
|
protected void | assertReadable()
if (mDataPointer == 0 || mSize == 0
|| (mAttachedFrame != null && !mAttachedFrame.hasNativeAllocation())) {
throw new NullPointerException("Attempting to read from null data frame!");
}
|
protected void | assertWritable()
if (isReadOnly()) {
throw new RuntimeException("Attempting to modify read-only native (structured) data!");
}
|
void | attachToFrame(android.filterfw.core.Frame frame)
System.loadLibrary("filterfw");
// We do not auto-retain. We expect the user to call retain() if they want to hold on to
// the frame.
mAttachedFrame = frame;
|
public int | count()
return (mDataPointer != 0) ? mSize / getElementSize() : 0;
|
private native boolean | deallocate(boolean ownsData)
|
public int | getElementSize()
return 1;
|
public boolean | isReadOnly()
return (mAttachedFrame != null) ? mAttachedFrame.isReadOnly() : false;
|
public android.filterfw.core.NativeBuffer | mutableCopy()
NativeBuffer result = null;
try {
Class myClass = getClass();
result = (NativeBuffer)myClass.newInstance();
} catch (Exception e) {
throw new RuntimeException("Unable to allocate a copy of " + getClass() + "! Make " +
"sure the class has a default constructor!");
}
if (mSize > 0 && !nativeCopyTo(result)) {
throw new RuntimeException("Failed to copy NativeBuffer to mutable instance!");
}
return result;
|
private native boolean | nativeCopyTo(android.filterfw.core.NativeBuffer buffer)
|
public android.filterfw.core.NativeBuffer | release()
// Decrement refcount
boolean doDealloc = false;
if (mAttachedFrame != null) {
doDealloc = (mAttachedFrame.release() == null);
} else if (mOwnsData) {
--mRefCount;
doDealloc = (mRefCount == 0);
}
// Deallocate if necessary
if (doDealloc) {
deallocate(mOwnsData);
return null;
} else {
return this;
}
|
public android.filterfw.core.NativeBuffer | retain()
if (mAttachedFrame != null) {
mAttachedFrame.retain();
} else if (mOwnsData) {
++mRefCount;
}
return this;
|
public int | size()
return mSize;
|