it.geosolutions.imageio.utilities
Class Utilities

Object
  extended by Utilities

public final class Utilities
extends Object

Simple class for utility methods.

Author:
Daniele Romagnoli, GeoSolutions, Martin Desruisseaux

Method Summary
static String adjustAttributeName(String attributeName)
          Deprecated. Use ImageIOUtilities.adjustAttributeName(String) instead
static void checkNotNull(Object checkMe, String message)
          Deprecated. Use ImageIOUtilities.checkNotNull(Object,String) instead
static boolean equals(Object object1, Object object2)
          Deprecated. Use ImageIOUtilities.equals(Object,Object) instead
static String getShortClassName(Object object)
          Deprecated. Use ImageIOUtilities.getShortClassName(Object) instead
static String getShortName(Class<?> classe)
          Deprecated. Use ImageIOUtilities.getShortName(Class) instead
static int getSubSamplingFactor2(int xSubsamplingFactor, int ySubsamplingFactor)
          Deprecated. Use ImageIOUtilities.getSubSamplingFactor2(int,int) instead
static boolean sameInterfaces(Class<?> object1, Class<?> object2, Class<?> base)
          Deprecated. Use ImageIOUtilities.sameInterfaces(Class,Class,Class) instead
static void setNativeAccelerationAllowed(String operation, boolean allowed)
          Deprecated. Use ImageIOUtilities.setNativeAccelerationAllowed(String,boolean) instead
static void setNativeAccelerationAllowed(String operation, boolean allowed, JAI jai)
          Deprecated. Use ImageIOUtilities.setNativeAccelerationAllowed(String,boolean,JAI) instead
static String spaces(int length)
          Deprecated. Use ImageIOUtilities.spaces(int) instead
static File urlToFile(URL url)
          Deprecated. Use ImageIOUtilities.urlToFile(URL) instead
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

equals

public static boolean equals(Object object1,
                             Object object2)
Deprecated. Use ImageIOUtilities.equals(Object,Object) instead

Convenience method for testing two objects for equality. One or both objects may be null.


sameInterfaces

public static boolean sameInterfaces(Class<?> object1,
                                     Class<?> object2,
                                     Class<?> base)
Deprecated. Use ImageIOUtilities.sameInterfaces(Class,Class,Class) instead

Returns true if the two specified objects implements exactly the same set of interfaces. Only interfaces assignable to base are compared. Declaration order doesn't matter. For example in ISO 19111, different interfaces exist for different coordinate system geometries (CartesianCS, PolarCS, etc.).


spaces

public static String spaces(int length)
Deprecated. Use ImageIOUtilities.spaces(int) instead

Returns a string of the specified length filled with white spaces. This method tries to return a pre-allocated string if possible.

Parameters:
length - The string length. Negative values are clamped to 0.
Returns:
A string of length length filled with white spaces.

getShortName

public static String getShortName(Class<?> classe)
Deprecated. Use ImageIOUtilities.getShortName(Class) instead

Returns a short class name for the specified class. This method will omit the package name. For example, it will return "String" instead of "java.lang.String" for a String object. It will also name array according Java language usage, for example "double[]" instead of "[D".

Parameters:
classe - The object class (may be null).
Returns:
A short class name for the specified object.

urlToFile

public static File urlToFile(URL url)
Deprecated. Use ImageIOUtilities.urlToFile(URL) instead

Takes a URL and converts it to a File. The attempts to deal with Windows UNC format specific problems, specifically files located on network shares and different drives. If the URL.getAuthority() returns null or is empty, then only the url's path property is used to construct the file. Otherwise, the authority is prefixed before the path. It is assumed that url.getProtocol returns "file". Authority is the drive or network share the file is located on. Such as "C:", "E:", "\\fooServer"

Parameters:
url - a URL object that uses protocol "file"
Returns:
a File that corresponds to the URL's location

getSubSamplingFactor2

public static int getSubSamplingFactor2(int xSubsamplingFactor,
                                        int ySubsamplingFactor)
Deprecated. Use ImageIOUtilities.getSubSamplingFactor2(int,int) instead

Given a pair of xSubsamplingFactor (xSSF) and ySubsamplingFactor (ySFF), look for a subsampling factor (SSF) in case xSSF != ySSF or they are not powers of 2. In case xSSF == ySSF == 2^N, the method return 0 (No optimal subsampling factor found).

Parameters:
xSubsamplingFactor -
ySubsamplingFactor -
Returns:

getShortClassName

public static String getShortClassName(Object object)
Deprecated. Use ImageIOUtilities.getShortClassName(Object) instead

Returns a short class name for the specified object. This method will omit the package name. For example, it will return "String" instead of "java.lang.String" for a String object.

Parameters:
object - The object (may be null).
Returns:
A short class name for the specified object.

adjustAttributeName

public static String adjustAttributeName(String attributeName)
Deprecated. Use ImageIOUtilities.adjustAttributeName(String) instead


setNativeAccelerationAllowed

public static void setNativeAccelerationAllowed(String operation,
                                                boolean allowed,
                                                JAI jai)
Deprecated. Use ImageIOUtilities.setNativeAccelerationAllowed(String,boolean,JAI) instead

Allows or disallow native acceleration for the specified operation on the given JAI instance. By default, JAI uses hardware accelerated methods when available. For example, it make use of MMX instructions on Intel processors. Unluckily, some native method crash the Java Virtual Machine under some circumstances. For example on JAI 1.1.2, the "Affine" operation on an image with float data type, bilinear interpolation and an ImageLayout rendering hint cause an exception in medialib native code. Disabling the native acceleration (i.e using the pure Java version) is a convenient workaround until Sun fix the bug.

Implementation note: the current implementation assumes that factories for native implementations are declared in the com.sun.media.jai.mlib package, while factories for pure java implementations are declared in the com.sun.media.jai.opimage package. It work for Sun's 1.1.2 implementation, but may change in future versions. If this method doesn't recognize the package, it does nothing.

Parameters:
operation - The operation name (e.g. "Affine").
allowed - false to disallow native acceleration.
jai - The instance of JAI we are going to work on. This argument can be omitted for the default JAI instance.
See Also:
JAI bug report 4906854

setNativeAccelerationAllowed

public static void setNativeAccelerationAllowed(String operation,
                                                boolean allowed)
Deprecated. Use ImageIOUtilities.setNativeAccelerationAllowed(String,boolean) instead

Allows or disallow native acceleration for the specified operation on the default JAI instance. This method is a shortcut for setNativeAccelerationAllowed(operation, allowed, JAI.getDefaultInstance()).

See Also:
setNativeAccelerationAllowed(String, boolean, JAI)

checkNotNull

public static final void checkNotNull(Object checkMe,
                                      String message)
Deprecated. Use ImageIOUtilities.checkNotNull(Object,String) instead



Copyright © 2006-2010 GeoSolutions. All Rights Reserved.