Package org.apache.tomcat.jni
Class Buffer
java.lang.Object
org.apache.tomcat.jni.Buffer
Buffer
- Author:
- Mladen Turk
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic longaddress(ByteBuffer buf) Returns the memory address of the ByteBuffer.static ByteBuffercalloc(int num, int size) Allocate a new ByteBuffer from memory and set all of the memory to 0static ByteBuffercreate(long mem, int size) Allocate a new ByteBuffer from already allocated memory.static voidfree(ByteBuffer buf) Deallocates or frees a memory block used by ByteBuffer
Warning : Call this method only on ByteBuffers that were created by calling Buffer.alloc or Buffer.calloc.static ByteBuffermalloc(int size) Allocate a new ByteBuffer from memorystatic ByteBufferpalloc(long p, int size) Allocate a new ByteBuffer from a poolstatic ByteBufferpcalloc(long p, int size) Allocate a new ByteBuffer from a pool and set all of the memory to 0static longsize(ByteBuffer buf) Returns the allocated memory size of the ByteBuffer.
-
Constructor Details
-
Buffer
public Buffer()
-
-
Method Details
-
malloc
Allocate a new ByteBuffer from memory- Parameters:
size- The amount of memory to allocate- Returns:
- The ByteBuffer with allocated memory
-
calloc
Allocate a new ByteBuffer from memory and set all of the memory to 0- Parameters:
num- Number of elements.size- Length in bytes of each element.- Returns:
- The ByteBuffer with allocated memory
-
palloc
Allocate a new ByteBuffer from a pool- Parameters:
p- The pool to allocate fromsize- The amount of memory to allocate- Returns:
- The ByteBuffer with allocated memory
-
pcalloc
Allocate a new ByteBuffer from a pool and set all of the memory to 0- Parameters:
p- The pool to allocate fromsize- The amount of memory to allocate- Returns:
- The ByteBuffer with allocated memory
-
create
Allocate a new ByteBuffer from already allocated memory.
Allocated memory must be provided from call to the Stdlib.alloc or Stdlib.calloc methods.- Parameters:
mem- The memory to usesize- The amount of memory to use- Returns:
- The ByteBuffer with attached memory
-
free
Deallocates or frees a memory block used by ByteBuffer
Warning : Call this method only on ByteBuffers that were created by calling Buffer.alloc or Buffer.calloc.- Parameters:
buf- Previously allocated ByteBuffer to be freed.
-
address
Returns the memory address of the ByteBuffer.- Parameters:
buf- Previously allocated ByteBuffer.- Returns:
- the memory address
-
size
Returns the allocated memory size of the ByteBuffer.- Parameters:
buf- Previously allocated ByteBuffer.- Returns:
- the size
-