org.apache.tomcat.util.compat

## Class JreCompat

- java.lang.Object
- - org.apache.tomcat.util.compat.JreCompat

-     public class JreCompat
      extends java.lang.Object

  This is the base implementation class for JRE compatibility and provides an implementation based on Java 6. Sub-classes may extend this class and provide alternative implementations for later JRE versions

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `JreCompat()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `abort(java.sql.Connection connection, java.util.concurrent.Executor executor)`
    `void` | `addBootModulePath(java.util.Deque<java.net.URL> classPathUrlsToProcess)` Obtains the URls for all the JARs on the module path when the JVM starts and adds them to the provided Deque.
    `boolean` | `canAcccess(java.lang.Object base, java.lang.reflect.AccessibleObject accessibleObject)` Is the accessibleObject accessible (as a result of appropriate module exports) on the provided instance?
    `void` | `closeOnCompletion(java.sql.Statement statement)`
    `void` | `disableCachingForJarUrlConnections()` Disables caching for JAR URL connections.
    `java.util.Locale` | `forLanguageTag(java.lang.String languageTag)`
    `boolean` | `generatedKeyAlwaysReturned(java.sql.DatabaseMetaData databaseMetaData)`
    `java.util.zip.GZIPOutputStream` | `getFlushableGZipOutputStream(java.io.OutputStream os)`
    `static JreCompat` | `getInstance()`
    `java.net.InetAddress` | `getLoopbackAddress()`
    `int` | `getNetworkTimeout(java.sql.Connection connection)`
    `<T> T` | `getObject(java.sql.CallableStatement callableStatement, int parameterIndex, java.lang.Class<T> type)`
    `<T> T` | `getObject(java.sql.CallableStatement callableStatement, java.lang.String parameterName, java.lang.Class<T> type)`
    `<T> T` | `getObject(java.sql.ResultSet resultSet, int parameterIndex, java.lang.Class<T> type)`
    `<T> T` | `getObject(java.sql.ResultSet resultSet, java.lang.String parameterName, java.lang.Class<T> type)`
    `java.sql.ResultSet` | `getPseudoColumns(java.sql.DatabaseMetaData databaseMetaData, java.lang.String catalog, java.lang.String schemaPattern, java.lang.String tableNamePattern, java.lang.String columnNamePattern)`
    `java.lang.String` | `getSchema(java.sql.Connection connection)`
    `boolean` | `isCloseOnCompletion(java.sql.Statement statement)`
    `boolean` | `isCommonsAnnotations1_1Available()`
    `boolean` | `isExported(java.lang.Class<?> type)` Is the given class in an exported package?
    `boolean` | `isInstanceOfInaccessibleObjectException(java.lang.Throwable t)` Test if the provided exception is an instance of java.lang.reflect.InaccessibleObjectException.
    `static boolean` | `isJre7Available()`
    `static boolean` | `isJre8Available()`
    `static boolean` | `isJre9Available()`
    `boolean` | `jarFileIsMultiRelease(java.util.jar.JarFile jarFile)` Is this JarFile a multi-release JAR file.
    `java.util.jar.JarFile` | `jarFileNewInstance(java.io.File f)` Creates a new JarFile instance.
    `int` | `jarFileRuntimeMajorVersion()`
    `void` | `setNetworkTimeout(java.sql.Connection connection, java.util.concurrent.Executor executor, int milliseconds)`
    `void` | `setSchema(java.sql.Connection connection, java.lang.String schema)`
    `void` | `setUseServerCipherSuitesOrder(javax.net.ssl.SSLEngine engine, boolean useCipherSuitesOrder)`
    `void` | `setUseServerCipherSuitesOrder(javax.net.ssl.SSLServerSocket socket, boolean useCipherSuitesOrder)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### JreCompat

          public JreCompat()

  - ### Method Detail

    - #### getInstance

          public static JreCompat getInstance()

    - #### isJre7Available

          public static boolean isJre7Available()

    - #### forLanguageTag

          public java.util.Locale forLanguageTag(java.lang.String languageTag)

    - #### getFlushableGZipOutputStream

          public java.util.zip.GZIPOutputStream getFlushableGZipOutputStream(java.io.OutputStream os)

    - #### getObject

          public <T> T getObject(java.sql.CallableStatement callableStatement,
                        int parameterIndex,
                        java.lang.Class<T> type)
                      throws java.sql.SQLException

      Throws:
        `java.sql.SQLException`

    - #### getObject

          public <T> T getObject(java.sql.CallableStatement callableStatement,
                        java.lang.String parameterName,
                        java.lang.Class<T> type)
                      throws java.sql.SQLException

      Throws:
        `java.sql.SQLException`

    - #### setSchema

          public void setSchema(java.sql.Connection connection,
                       java.lang.String schema)
                         throws java.sql.SQLException

      Throws:
        `java.sql.SQLException`

    - #### getSchema

          public java.lang.String getSchema(java.sql.Connection connection)
                                     throws java.sql.SQLException

      Throws:
        `java.sql.SQLException`

    - #### abort

          public void abort(java.sql.Connection connection,
                   java.util.concurrent.Executor executor)
                     throws java.sql.SQLException

      Throws:
        `java.sql.SQLException`

    - #### setNetworkTimeout

          public void setNetworkTimeout(java.sql.Connection connection,
                               java.util.concurrent.Executor executor,
                               int milliseconds)
                                 throws java.sql.SQLException

      Throws:
        `java.sql.SQLException`

    - #### getNetworkTimeout

          public int getNetworkTimeout(java.sql.Connection connection)
                                throws java.sql.SQLException

      Throws:
        `java.sql.SQLException`

    - #### getPseudoColumns

          public java.sql.ResultSet getPseudoColumns(java.sql.DatabaseMetaData databaseMetaData,
                                            java.lang.String catalog,
                                            java.lang.String schemaPattern,
                                            java.lang.String tableNamePattern,
                                            java.lang.String columnNamePattern)
                                              throws java.sql.SQLException

      Throws:
        `java.sql.SQLException`

    - #### generatedKeyAlwaysReturned

          public boolean generatedKeyAlwaysReturned(java.sql.DatabaseMetaData databaseMetaData)
                                             throws java.sql.SQLException

      Throws:
        `java.sql.SQLException`

    - #### getObject

          public <T> T getObject(java.sql.ResultSet resultSet,
                        int parameterIndex,
                        java.lang.Class<T> type)
                      throws java.sql.SQLException

      Throws:
        `java.sql.SQLException`

    - #### getObject

          public <T> T getObject(java.sql.ResultSet resultSet,
                        java.lang.String parameterName,
                        java.lang.Class<T> type)
                      throws java.sql.SQLException

      Throws:
        `java.sql.SQLException`

    - #### closeOnCompletion

          public void closeOnCompletion(java.sql.Statement statement)
                                 throws java.sql.SQLException

      Throws:
        `java.sql.SQLException`

    - #### isCloseOnCompletion

          public boolean isCloseOnCompletion(java.sql.Statement statement)
                                      throws java.sql.SQLException

      Throws:
        `java.sql.SQLException`

    - #### getLoopbackAddress

          public java.net.InetAddress getLoopbackAddress()

    - #### isJre8Available

          public static boolean isJre8Available()

    - #### setUseServerCipherSuitesOrder

          public void setUseServerCipherSuitesOrder(javax.net.ssl.SSLServerSocket socket,
                                           boolean useCipherSuitesOrder)

    - #### setUseServerCipherSuitesOrder

          public void setUseServerCipherSuitesOrder(javax.net.ssl.SSLEngine engine,
                                           boolean useCipherSuitesOrder)

    - #### isJre9Available

          public static boolean isJre9Available()

    - #### isInstanceOfInaccessibleObjectException

          public boolean isInstanceOfInaccessibleObjectException(java.lang.Throwable t)

      Test if the provided exception is an instance of java.lang.reflect.InaccessibleObjectException.
      Parameters:
        `t` - The exception to test
      Returns:
        `true` if the exception is an instance of InaccessibleObjectException, otherwise `false`

    - #### disableCachingForJarUrlConnections

          public void disableCachingForJarUrlConnections()
                                                  throws java.io.IOException

      Disables caching for JAR URL connections. For Java 8 and earlier, this also disables caching for ALL URL connections.
      Throws:
        `java.io.IOException` - If a dummy JAR URLConnection can not be created

    - #### addBootModulePath

          public void addBootModulePath(java.util.Deque<java.net.URL> classPathUrlsToProcess)

      Obtains the URls for all the JARs on the module path when the JVM starts and adds them to the provided Deque.
      Parameters:
        `classPathUrlsToProcess` - The Deque to which the modules should be added

    - #### jarFileNewInstance

          public java.util.jar.JarFile jarFileNewInstance(java.io.File f)
                                                   throws java.io.IOException

      Creates a new JarFile instance. When running on Java 9 and later, the JarFile will be multi-release JAR aware.
      Parameters:
        `f` - The JAR file to open
      Returns:
        A JarFile instance based on the provided file
      Throws:
        `java.io.IOException` - If an I/O error occurs creating the JarFile instance

    - #### jarFileIsMultiRelease

          public boolean jarFileIsMultiRelease(java.util.jar.JarFile jarFile)

      Is this JarFile a multi-release JAR file.
      Parameters:
        `jarFile` - The JarFile to test
      Returns:
        `true` If it is a multi-release JAR file and is configured to behave as such.

    - #### jarFileRuntimeMajorVersion

          public int jarFileRuntimeMajorVersion()

    - #### isCommonsAnnotations1_1Available

          public boolean isCommonsAnnotations1_1Available()

    - #### canAcccess

          public boolean canAcccess(java.lang.Object base,
                           java.lang.reflect.AccessibleObject accessibleObject)

      Is the accessibleObject accessible (as a result of appropriate module exports) on the provided instance?
      Parameters:
        `base` - The specific instance to be tested.
        `accessibleObject` - The method/field/constructor to be tested.
      Returns:
        {code true} if the AccessibleObject can be accessed otherwise {code false}

    - #### isExported

          public boolean isExported(java.lang.Class<?> type)

      Is the given class in an exported package?
      Parameters:
        `type` - The class to test
      Returns:
        Always `true` for Java 8. `true` if the enclosing package is exported for Java 9+

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