Overview | Package | Class | Tree | Deprecated | Index | Help
| Apache Tomcat 6.0.53
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.tomcat.jni
Class Buffer

    java.lang.Object
      org.apache.tomcat.jni.Buffer

    public class Buffer

extends java.lang.Object

Buffer

Author:
  Mladen Turk

Constructor Summary
`Buffer()`

Method Summary
`static long` | `address(java.nio.ByteBuffer buf)` Returns the memory address of the ByteBuffer.
`static java.nio.ByteBuffer` | `calloc(int num, int size)` Allocate a new ByteBuffer from memory and set all of the memory to 0
`static java.nio.ByteBuffer` | `create(long mem, int size)` Allocate a new ByteBuffer from already allocated memory.
`static void` | `free(java.nio.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 java.nio.ByteBuffer` | `malloc(int size)` Allocate a new ByteBuffer from memory
`static java.nio.ByteBuffer` | `palloc(long p, int size)` Allocate a new ByteBuffer from a pool
`static java.nio.ByteBuffer` | `pcalloc(long p, int size)` Allocate a new ByteBuffer from a pool and set all of the memory to 0
`static long` | `size(java.nio.ByteBuffer buf)` Returns the allocated memory size of the ByteBuffer.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Buffer

    public Buffer()

Method Detail

### malloc

    public static java.nio.ByteBuffer malloc(int size)

  Allocate a new ByteBuffer from memory

  Parameters:
    `size` - The amount of memory to allocate
  Returns:
    The ByteBuffer with allocated memory

### calloc

    public static java.nio.ByteBuffer calloc(int num,
                                             int size)

  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

    public static java.nio.ByteBuffer palloc(long p,
                                             int size)

  Allocate a new ByteBuffer from a pool

  Parameters:
    `p` - The pool to allocate from
    `size` - The amount of memory to allocate
  Returns:
    The ByteBuffer with allocated memory

### pcalloc

    public static java.nio.ByteBuffer pcalloc(long p,
                                              int size)

  Allocate a new ByteBuffer from a pool and set all of the memory to 0

  Parameters:
    `p` - The pool to allocate from
    `size` - The amount of memory to allocate
  Returns:
    The ByteBuffer with allocated memory

### create

    public static java.nio.ByteBuffer create(long mem,
                                             int size)

  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 use
    `size` - The amount of memory to use
  Returns:
    The ByteBuffer with attached memory

### free

    public static void free(java.nio.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.

  Parameters:
    `buf` - Previously allocated ByteBuffer to be freed.

### address

    public static long address(java.nio.ByteBuffer buf)

  Returns the memory address of the ByteBuffer.

  Parameters:
    `buf` - Previously allocated ByteBuffer.

### size

    public static long size(java.nio.ByteBuffer buf)

  Returns the allocated memory size of the ByteBuffer.

  Parameters:
    `buf` - Previously allocated ByteBuffer.

Overview | Package | Class | Tree | Deprecated | Index | Help
| Apache Tomcat 6.0.53
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.