public void read(long at, byte []target, int offset, int length) { assertAllocated(); if( length < 0 ) throw new IllegalArgumentException("length cannot be negative"); if( offset < 0 ) throw new IllegalArgumentException("offset cannot be negative"); if( at < 0 ) throw new IllegalArgumentException("at cannot be negative"); if( at+length > capacity ) throw new ArrayIndexOutOfBoundsException("at + length exceeds the capacity of this object"); if( offset+length > target.length) throw new ArrayIndexOutOfBoundsException("offset + length exceed the length of the target buffer"); NativeBufferJNI.buffer_copy(self, at, target, offset, length); }
void release() { assertAllocated(); int r = retained.decrementAndGet(); if( r < 0 ) { throw new Error("The object has already been deleted."); } else if( r==0 ) { NativeBufferJNI.free(self); self = 0; } } }
private Allocation(long size) { super(NativeBufferJNI.malloc(size)); }
private Allocation(long size) { super(NativeBufferJNI.malloc(size)); }
private Allocation(long size) { super(NativeBufferJNI.malloc(size)); }
public byte[] toByteArray() { if( size_ > Integer.MAX_VALUE ) { throw new ArrayIndexOutOfBoundsException("Native slice is larger than the maximum Java array"); } byte []rc = new byte[(int) size_]; NativeBuffer.NativeBufferJNI.buffer_copy(data_, 0, rc, 0, rc.length); return rc; }
public byte[] toByteArray() { long l = length(); if( l > Integer.MAX_VALUE ) { throw new ArrayIndexOutOfBoundsException("Native string is larger than the maximum Java array"); } byte []rc = new byte[(int) l]; NativeBuffer.NativeBufferJNI.buffer_copy(StdStringJNI.c_str_ptr(self), 0, rc, 0, rc.length); return rc; } }
public byte[] toByteArray() { long l = length(); if( l > Integer.MAX_VALUE ) { throw new ArrayIndexOutOfBoundsException("Native string is larger than the maximum Java array"); } byte []rc = new byte[(int) l]; NativeBuffer.NativeBufferJNI.buffer_copy(StdStringJNI.c_str_ptr(self), 0, rc, 0, rc.length); return rc; } }
public byte[] toByteArray() { if( size_ > Integer.MAX_VALUE ) { throw new ArrayIndexOutOfBoundsException("Native slice is larger than the maximum Java array"); } byte []rc = new byte[(int) size_]; NativeBuffer.NativeBufferJNI.buffer_copy(data_, 0, rc, 0, rc.length); return rc; }
public void write(long at, byte []source, int offset, int length) { assertAllocated(); if( length < 0 ) throw new IllegalArgumentException("length cannot be negative"); if( offset < 0 ) throw new IllegalArgumentException("offset cannot be negative"); if( at < 0 ) throw new IllegalArgumentException("at cannot be negative"); if( at+length > capacity ) throw new ArrayIndexOutOfBoundsException("at + length exceeds the capacity of this object"); if( offset+length > source.length) throw new ArrayIndexOutOfBoundsException("offset + length exceed the length of the source buffer"); NativeBufferJNI.buffer_copy(source, offset, self, at, length); }
public byte[] toByteArray() { if( size_ > Integer.MAX_VALUE ) { throw new ArrayIndexOutOfBoundsException("Native slice is larger than the maximum Java array"); } byte []rc = new byte[(int) size_]; NativeBuffer.NativeBufferJNI.buffer_copy(data_, 0, rc, 0, rc.length); return rc; }
void release() { assertAllocated(); int r = retained.decrementAndGet(); if( r < 0 ) { throw new Error("The object has already been deleted."); } else if( r==0 ) { NativeBufferJNI.free(self); self = 0; } } }
public void write(long at, byte []source, int offset, int length) { assertAllocated(); if( length < 0 ) throw new IllegalArgumentException("length cannot be negative"); if( offset < 0 ) throw new IllegalArgumentException("offset cannot be negative"); if( at < 0 ) throw new IllegalArgumentException("at cannot be negative"); if( at+length > capacity ) throw new ArrayIndexOutOfBoundsException("at + length exceeds the capacity of this object"); if( offset+length > source.length) throw new ArrayIndexOutOfBoundsException("offset + length exceed the length of the source buffer"); NativeBufferJNI.buffer_copy(source, offset, self, at, length); }
public void read(long at, byte []target, int offset, int length) { assertAllocated(); if( length < 0 ) throw new IllegalArgumentException("length cannot be negative"); if( offset < 0 ) throw new IllegalArgumentException("offset cannot be negative"); if( at < 0 ) throw new IllegalArgumentException("at cannot be negative"); if( at+length > capacity ) throw new ArrayIndexOutOfBoundsException("at + length exceeds the capacity of this object"); if( offset+length > target.length) throw new ArrayIndexOutOfBoundsException("offset + length exceed the length of the target buffer"); NativeBufferJNI.buffer_copy(self, at, target, offset, length); }
public void read(long at, byte []target, int offset, int length) { assertAllocated(); if( length < 0 ) throw new IllegalArgumentException("length cannot be negative"); if( offset < 0 ) throw new IllegalArgumentException("offset cannot be negative"); if( at < 0 ) throw new IllegalArgumentException("at cannot be negative"); if( at+length > capacity ) throw new ArrayIndexOutOfBoundsException("at + length exceeds the capacity of this object"); if( offset+length > target.length) throw new ArrayIndexOutOfBoundsException("offset + length exceed the length of the target buffer"); NativeBufferJNI.buffer_copy(self, at, target, offset, length); }
public byte[] toByteArray() { long l = length(); if( l > Integer.MAX_VALUE ) { throw new ArrayIndexOutOfBoundsException("Native string is larger than the maximum Java array"); } byte []rc = new byte[(int) l]; NativeBuffer.NativeBufferJNI.buffer_copy(StdStringJNI.c_str_ptr(self), 0, rc, 0, rc.length); return rc; } }
public void write(long at, byte []source, int offset, int length) { assertAllocated(); if( length < 0 ) throw new IllegalArgumentException("length cannot be negative"); if( offset < 0 ) throw new IllegalArgumentException("offset cannot be negative"); if( at < 0 ) throw new IllegalArgumentException("at cannot be negative"); if( at+length > capacity ) throw new ArrayIndexOutOfBoundsException("at + length exceeds the capacity of this object"); if( offset+length > source.length) throw new ArrayIndexOutOfBoundsException("offset + length exceed the length of the source buffer"); NativeBufferJNI.buffer_copy(source, offset, self, at, length); }
void release() { assertAllocated(); int r = retained.decrementAndGet(); if( r < 0 ) { throw new Error("The object has already been deleted."); } else if( r==0 ) { NativeBufferJNI.free(self); self = 0; } } }