Home / Type/ CleanableDirectBuffer Type — netty Architecture

CleanableDirectBuffer Type — netty Architecture

Architecture documentation for the CleanableDirectBuffer type/interface in CleanableDirectBuffer.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  f87b5ae5_c9f5_4578_0e1a_53eb470f788b["CleanableDirectBuffer"]
  26fe891c_c735_573a_af8f_659badb40c36["CleanableDirectBuffer.java"]
  f87b5ae5_c9f5_4578_0e1a_53eb470f788b -->|defined in| 26fe891c_c735_573a_af8f_659badb40c36
  style f87b5ae5_c9f5_4578_0e1a_53eb470f788b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

common/src/main/java/io/netty/util/internal/CleanableDirectBuffer.java lines 23–56

public interface CleanableDirectBuffer {
    /**
     * Get the buffer instance.
     * <p>
     * Note: the buffer must not be accessed after the {@link #clean()} method has been called.
     *
     * @return The {@link ByteBuffer} instance.
     */
    ByteBuffer buffer();

    /**
     * Deallocate the buffer. This method can only be called once per instance,
     * and all usages of the buffer must have ceased before this method is called,
     * and the buffer must not be accessed again after this method has been called.
     */
    void clean();

    /**
     * @return {@code true} if the {@linkplain #memoryAddress() native memory address} is available,
     * otherwise {@code false}.
     */
    default boolean hasMemoryAddress() {
        return false;
    }

    /**
     * Get the native memory address, but only if {@link #hasMemoryAddress()} returns true,
     * otherwise this may return an unspecified value or throw an exception.
     * @return The native memory address of this buffer, if available.
     */
    default long memoryAddress() {
        return 0;
    }
}

Frequently Asked Questions

What is the CleanableDirectBuffer type?
CleanableDirectBuffer is a type/interface in the netty codebase, defined in common/src/main/java/io/netty/util/internal/CleanableDirectBuffer.java.
Where is CleanableDirectBuffer defined?
CleanableDirectBuffer is defined in common/src/main/java/io/netty/util/internal/CleanableDirectBuffer.java at line 23.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free