JdkCompat (Tomcat API Documentation)
Keywords: org.apache.tomcat.util.compat.JdkCompat class

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

## org.apache.tomcat.util.compat
Class JdkCompat

    java.lang.Object
      org.apache.tomcat.util.compat.JdkCompat

Direct Known Subclasses:
  Jdk14Compat

public class JdkCompat
extends java.lang.Object

General-purpose utility to provide backward-compatibility and JDK independence. This allow use of JDK1.3 ( or higher ) facilities if available, while maintaining the code compatible with older VMs. The goal is to make backward-compatiblity reasonably easy. The base class supports JDK1.3 behavior.

Author:
  Tim Funk

Field Summary
`static java.lang.String` | `JAVA_1_0`
`static java.lang.String` | `JAVA_1_1`
`static java.lang.String` | `JAVA_1_2`
`static java.lang.String` | `JAVA_1_3`
`static java.lang.String` | `JAVA_1_4`
`static java.lang.String` | `JAVA_1_5`

Constructor Summary
`protected` | `JdkCompat()` Default no-arg constructor

Method Summary
`void` | `chainException(java.lang.Throwable wrapper, java.lang.Throwable wrapped)` Chains the `wrapped` throwable to the `wrapper` throwable.
`static java.lang.String` | `getJavaVersion()` Return java version as a string
`static JdkCompat` | `getJdkCompat()` Get a compatibiliy helper class.
`long` | `getMaxMemory()` Return the maximum amount of memory the JVM will attempt to use.
`java.lang.String` | `getPartialServletStackTrace(java.lang.Throwable t)` Print out a partial servlet stack trace (truncating at the last occurrence of javax.servlet.).
`java.net.ServerSocket` | `getUnboundSocket(javax.net.ServerSocketFactory ssf)` Obtain an unbound socket from the ServerSocketFactory.
`java.net.URL` | `getURI(java.io.File file)` Return the URI for the given file.
`static boolean` | `isJava14()`
`static boolean` | `isJava15()`
`static boolean` | `isJava2()`
`java.lang.String[]` | `split(java.lang.String path, java.lang.String pat)` Splits a string into it's components.

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

Field Detail

### JAVA_1_0

    public static final java.lang.String JAVA_1_0

See Also:
  Constant Field Values

### JAVA_1_1

    public static final java.lang.String JAVA_1_1

See Also:
  Constant Field Values

### JAVA_1_2

    public static final java.lang.String JAVA_1_2

See Also:
  Constant Field Values

### JAVA_1_3

    public static final java.lang.String JAVA_1_3

See Also:
  Constant Field Values

### JAVA_1_4

    public static final java.lang.String JAVA_1_4

See Also:
  Constant Field Values

### JAVA_1_5

    public static final java.lang.String JAVA_1_5

See Also:
  Constant Field Values

Constructor Detail

### JdkCompat

    protected JdkCompat()

  Default no-arg constructor

Method Detail

### getJavaVersion

    public static java.lang.String getJavaVersion()

  Return java version as a string

### isJava2

    public static boolean isJava2()

### isJava14

    public static boolean isJava14()

### isJava15

    public static boolean isJava15()

### getJdkCompat

    public static JdkCompat getJdkCompat()

  Get a compatibiliy helper class.

### getURI

    public java.net.URL getURI(java.io.File file)
                        throws java.net.MalformedURLException

  Return the URI for the given file. Originally created for o.a.c.loader.WebappClassLoader

  Parameters:
    `file` - The file to wrap into URI
  Returns:
    A URI as a URL
  Throws:
    `java.net.MalformedURLException` - Doh ;)

### getMaxMemory

    public long getMaxMemory()

  Return the maximum amount of memory the JVM will attempt to use.

### getPartialServletStackTrace

    public java.lang.String getPartialServletStackTrace(java.lang.Throwable t)

  Print out a partial servlet stack trace (truncating at the last occurrence of javax.servlet.).

### split

    public java.lang.String[] split(java.lang.String path,
                                    java.lang.String pat)

  Splits a string into it's components.

  Parameters:
    `path` - String to split
    `pat` - Pattern to split at
  Returns:
    the components of the path

### chainException

    public void chainException(java.lang.Throwable wrapper,
                               java.lang.Throwable wrapped)

  Chains the `wrapped` throwable to the `wrapper` throwable.

  Parameters:
    `wrapper` - The wrapper throwable
    `wrapped` - The throwable to be wrapped

### getUnboundSocket

    public java.net.ServerSocket getUnboundSocket(javax.net.ServerSocketFactory ssf)
                                           throws java.io.IOException

  Obtain an unbound socket from the ServerSocketFactory. Return null if unbound sockets cannot be created.

  Throws:
    `java.io.IOException`

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

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