Repository: netty/netty
File: common/src/main/java/io/netty/util/internal/PlatformDependent.java (Java)

Code before:
     * direct memory access.
     */
    public static boolean hasUnsafe() {
        return UNSAFE_UNAVAILABILITY_CAUSE == null;
    }

    /**
     * Return the reason (if any) why {@code sun.misc.Unsafe} was not available.
     */
    public static Throwable getUnsafeUnavailabilityCause() {
        return UNSAFE_UNAVAILABILITY_CAUSE;
    }

    /**
     * {@code true} if and only if the platform supports unaligned access.
     *
     * @see <a href="https://en.wikipedia.org/wiki/Segmentation_fault#Bus_error">Wikipedia on segfault</a>
     */
    public static boolean isUnaligned() {
        return PlatformDependent0.isUnaligned();
    }

    /**
     * {@code true} if and only if unaligned access support could be queried from the runtime.
     */
    public static boolean isUnalignedAvailable() {
        return PlatformDependent0.isUnalignedAvailable();
    }

    /**
     * Returns {@code true} if the platform has reliable low-level direct buffer access API and a user has not specified
     * {@code -Dio.netty.noPreferDirect} option.
     */
    public static boolean directBufferPreferred() {
        return DIRECT_BUFFER_PREFERRED;
    }

    /**
     * Returns {@code true} if user has specified
     * {@code -Dio.netty.noPreferDirect=true} option.
     */
    public static boolean isExplicitNoPreferDirect() {
        return EXPLICIT_NO_PREFER_DIRECT;
    }

    /**
     * Return {@code true} if the selected cleaner can free direct buffers in a controlled way. This guarantee only
     * applies for buffers allocated via {@link #allocateDirect(int)} and when using the {@code clean} method of the
     * returned {@link CleanableDirectBuffer}.
     */
    public static boolean canReliabilyFreeDirectBuffers() {

Review comment (suggestion):
Could we come up with a more descriptive method name?

I'd also like a more detailed javadoc description, because it's not clear to me what exactly this means; what question is being asked and answered with this method.

Code after:
     * direct memory access.
     */
    public static boolean hasUnsafe() {
        return UNSAFE_UNAVAILABILITY_CAUSE == null;
    }

    /**
     * Return the reason (if any) why {@code sun.misc.Unsafe} was not available.
     */
    public static Throwable getUnsafeUnavailabilityCause() {
        return UNSAFE_UNAVAILABILITY_CAUSE;
    }

    /**
     * {@code true} if and only if the platform supports unaligned access.
     *
     * @see <a href="https://en.wikipedia.org/wiki/Segmentation_fault#Bus_error">Wikipedia on segfault</a>
     */
    public static boolean isUnaligned() {
        return PlatformDependent0.isUnaligned();
    }

    /**
     * Returns {@code true} if the platform has reliable low-level direct buffer access API and a user has not specified
     * {@code -Dio.netty.noPreferDirect} option.
     */
    public static boolean directBufferPreferred() {
        return DIRECT_BUFFER_PREFERRED;
    }

    /**
     * Returns {@code true} if user has specified
     * {@code -Dio.netty.noPreferDirect=true} option.
     */
    public static boolean isExplicitNoPreferDirect() {
        return EXPLICIT_NO_PREFER_DIRECT;
    }

    /**
     * Return {@code true} if the selected cleaner can free direct buffers in a controlled way. This guarantee only
     * applies for buffers allocated via {@link #allocateDirect(int)} and when using the {@code clean} method of the
     * returned {@link CleanableDirectBuffer}.
     */
    public static boolean canReliabilyFreeDirectBuffers() {
        return CLEANER != NOOP;
    }

    /**
     * Returns the maximum memory reserved for direct buffer allocation.
     */
    public static long maxDirectMemory() {