Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## gl4java.utils
Class DirectBufferCleanup

    java.lang.Object
      |
      +--gl4java.utils.DirectBufferCleanup

public class DirectBufferCleanup
extends java.lang.Object

Provides a cleanup mechanism for direct buffers instantiated via the JNI entry point `NewDirectByteBuffer`. A direct buffer can be registered with a DirectBufferCleanup. When that buffer is reclaimed by the garbage collector, the callback associated with that DirectBufferCleanup is called on the address the direct buffer was associated with.

Inner Class Summary
`static interface` | `DirectBufferCleanup.Callback`

Constructor Summary
`DirectBufferCleanup(DirectBufferCleanup.Callback cb)`

Method Summary
`void` | `register(gl4java.utils.Buffer buf)` Registers the given buffer (which must be a direct buffer) for later cleanup when it is reclaimed by the garbage collector.
`void` | `start()` The DirectBufferCleanup contains an internal thread which is started automatically upon construction.
`void` | `stop()` Stops the internal thread of this DirectBufferCleanup.

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

Constructor Detail

### DirectBufferCleanup

    public DirectBufferCleanup(DirectBufferCleanup.Callback cb)

Method Detail

### start

    public void start()

  The DirectBufferCleanup contains an internal thread which is started automatically upon construction. This method starts the thread again if it is manually stopped via the `stop()` method.

### stop

    public void stop()

  Stops the internal thread of this DirectBufferCleanup. Should not typically be necessary.

### register

    public void register(gl4java.utils.Buffer buf)
                  throws java.lang.IllegalArgumentException

  Registers the given buffer (which must be a direct buffer) for later cleanup when it is reclaimed by the garbage collector.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD