org.apache.tomcat.util.compat
Class JdkCompat

java.lang.Object
  extended by org.apache.tomcat.util.compat.JdkCompat
Direct Known Subclasses:
Jdk14Compat

public class JdkCompat
extends 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 String JAVA_1_0
           
static String JAVA_1_1
           
static String JAVA_1_2
           
static String JAVA_1_3
           
static String JAVA_1_4
           
 
Constructor Summary
protected JdkCompat()
          Default no-arg constructor
 
Method Summary
static 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.
 String getPartialServletStackTrace(Throwable t)
          Print out a partial servlet stack trace (truncating at the last occurrence of javax.servlet.).
 URL getURI(File file)
          Return the URI for the given file.
static boolean isJava14()
           
static boolean isJava2()
           
 String[] split(String path, 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 String JAVA_1_0
See Also:
Constant Field Values

JAVA_1_1

public static final String JAVA_1_1
See Also:
Constant Field Values

JAVA_1_2

public static final String JAVA_1_2
See Also:
Constant Field Values

JAVA_1_3

public static final String JAVA_1_3
See Also:
Constant Field Values

JAVA_1_4

public static final String JAVA_1_4
See Also:
Constant Field Values
Constructor Detail

JdkCompat

protected JdkCompat()
Default no-arg constructor

Method Detail

getJavaVersion

public static String getJavaVersion()
Return java version as a string


isJava2

public static boolean isJava2()

isJava14

public static boolean isJava14()

getJdkCompat

public static JdkCompat getJdkCompat()
Get a compatibiliy helper class.


getURI

public URL getURI(File file)
           throws MalformedURLException
Return the URI for the given file. Originally created for o.a.c.loader.WebappClassLoader

Parameters:
File - to wrap into URI
Returns:
A URI as a URL
Throws:
MalformedURLException

getMaxMemory

public long getMaxMemory()
Return the maximum amount of memory the JVM will attempt to use.


getPartialServletStackTrace

public String getPartialServletStackTrace(Throwable t)
Print out a partial servlet stack trace (truncating at the last occurrence of javax.servlet.).


split

public String[] split(String path,
                      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


Copyright © 2005-2015 Oracle Corporation. All Rights Reserved.