Class PlatformInternals


  • public class PlatformInternals
    extends Object
    This class provides static utility functionality to access certain required access to internal JDK logic without using JDK-version-specific dependencies. E.g. JDK-internal classes in the "sun.*" package were moved to the "jdk.*" package but access to those is required to compensate for certain shortcomings in the JDK's public API.

    This class does the magic trick of allowing JDK-specific access without having JDK-specific dependencies in the source code. Congratulations and felicitation always welcomed.

    In more general terms, this class abstracts platform-version-specific details.

    • Constructor Detail

      • PlatformInternals

        public PlatformInternals()
    • Method Detail

      • getClassDirectbuffer

        public static Class<?> getClassDirectbuffer()
      • getClassCleaner

        public static Class<?> getClassCleaner()
      • guaranteeUsability

        public static void guaranteeUsability()
        Guarantees the usability of this class by validating if all functionality is usable. This does not necessarily mean that all attempts to resolve JDK-internal code structures were successful. Some have alternative options that are used as a fallback.
        Throws:
        Error
      • isDirectBuffer

        public static final boolean isDirectBuffer​(ByteBuffer directBuffer)
        Just to have all jdk internal types here at one place.
        Parameters:
        directBuffer -
      • guaranteeDirectBuffer

        public static final <DB extends ByteBuffer> DB guaranteeDirectBuffer​(DB directBuffer)
      • ensureDirectBufferCapacity

        public static final ByteBuffer ensureDirectBufferCapacity​(ByteBuffer current,
                                                                  long capacity)
      • deallocateDirectBuffer

        public static final void deallocateDirectBuffer​(ByteBuffer directBuffer)
        No idea if this method is really (still?) necesssary, but it sounds reasonable. See http://stackoverflow.com/questions/8462200/examples-of-forcing-freeing-of-native-memory-direct-bytebuffer-has-allocated-us
        Parameters:
        directBuffer -
      • getDirectBufferAddress

        public static final long getDirectBufferAddress​(ByteBuffer directBuffer)
      • directBufferToArray

        public static final byte[] directBufferToArray​(ByteBuffer directBuffer)
      • getResolvingStatus

        public static final String getResolvingStatus()
      • printInitializationWarnings

        public static final void printInitializationWarnings​(PrintStream printStream)