java.lang.Object | |
↳ | com.facebook.imagepipeline.memory.NativeMemoryChunk |
Wrapper around chunk of native memory.
This class uses JNI to obtain pointer to native memory and read/write data from/to it.
Native code used by this class is shipped as part of libimagepipeline.so
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
NativeMemoryChunk(int size) | |||||||||||
NativeMemoryChunk() |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
synchronized void |
close()
This has to be called before we get rid of this object in order to release underlying memory
| ||||||||||
void |
copy(int offset, NativeMemoryChunk other, int otherOffset, int count)
Copy bytes from native memory wrapped by this NativeMemoryChunk instance to
native memory wrapped by other NativeMemoryChunk
| ||||||||||
long | getNativePtr() | ||||||||||
int |
getSize()
Get the size of this memory chunk.
| ||||||||||
synchronized boolean |
isClosed()
Is this chunk already closed (aka freed) ?
| ||||||||||
synchronized int |
read(int nativeMemoryOffset, byte[] byteArray, int byteArrayOffset, int count)
Copy bytes from native memory to byte array.
| ||||||||||
synchronized byte |
read(int offset)
Read byte at given offset.
| ||||||||||
synchronized int |
write(int nativeMemoryOffset, byte[] byteArray, int byteArrayOffset, int count)
Copy bytes from byte array to native memory.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void |
finalize()
A finalizer, just in case.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() | |||||||||||
![]() |
This has to be called before we get rid of this object in order to release underlying memory
Copy bytes from native memory wrapped by this NativeMemoryChunk instance to native memory wrapped by other NativeMemoryChunk
offset | number of first byte to copy |
---|---|
other | other NativeMemoryChunk to copy to |
otherOffset | number of first byte to write to |
count | number of bytes to copy |
Get the size of this memory chunk. Ignores if this chunk has been closed
Is this chunk already closed (aka freed) ?
Copy bytes from native memory to byte array.
nativeMemoryOffset | number of first byte to copy |
---|---|
byteArray | byte array to copy to |
byteArrayOffset | number of first byte in byte array to be written |
count | number of bytes to copy |
Read byte at given offset.
Copy bytes from byte array to native memory.
nativeMemoryOffset | number of first byte to be written by copy operation |
---|---|
byteArray | byte array to copy from |
byteArrayOffset | number of first byte in byteArray to copy |
count | number of bytes to copy |