com.skype.connector
Class ConnectorUtils

java.lang.Object
  extended by com.skype.connector.ConnectorUtils

public final class ConnectorUtils
extends Object

Connector helper class. Generic helper methods for all connectors.


Method Summary
static boolean checkLibraryInPath(String libFilename)
          Check if a lib file is to be found by the JVM.
static void checkNotNull(String name, Object value)
          Check an object if its not null.
static boolean deleteDir(File dir)
          Deletes all files and subdirectories under dir.
static boolean extractFromJar(String filename, String destinationDirectory)
          Extract a file for a jarfile on the classpath.
static boolean extractFromJar(String searchString, String filename, String destinationDirectory)
          Extract a file from a jarfile on the classpath.
static boolean extractFromJarToTemp(String filename)
          Extract a file for a jarfile on the classpath.
static boolean isInJar(String searchString)
          Search for a file in the jars of the classpath, return true if found.
static void loadLibrary(String libraryName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

checkNotNull

public static void checkNotNull(String name,
                                Object value)
Check an object if its not null. If it is a NullPointerException will be thrown.

Parameters:
name - Name of the object, used in the exception message.
value - The object to check.

extractFromJarToTemp

public static boolean extractFromJarToTemp(String filename)
Extract a file for a jarfile on the classpath. Used to extract library files to the System temp directory. System.getProperty("java.io.tmpdir").

Parameters:
filename - The file to search and extract.
Returns:
true if file could be found and extracted.

extractFromJar

public static boolean extractFromJar(String filename,
                                     String destinationDirectory)
Extract a file for a jarfile on the classpath. Used to extract library files.

Parameters:
filename - The file to search and extract.
destinationDirectory - The directory to place it in.
Returns:
true if file could be found and extracted.

extractFromJar

public static boolean extractFromJar(String searchString,
                                     String filename,
                                     String destinationDirectory)
Extract a file from a jarfile on the classpath. Used to extract library files.

Parameters:
searchString - The path+filename to search for.
filename - The file to search and extract.
destinationDirectory - The directory to place it in.
Returns:
true if file could be found and extracted.

isInJar

public static boolean isInJar(String searchString)
Search for a file in the jars of the classpath, return true if found.

Parameters:
searchString - The path+filename to search for.
Returns:
true if file could be found.

checkLibraryInPath

public static boolean checkLibraryInPath(String libFilename)
Check if a lib file is to be found by the JVM.

Parameters:
libFilename - the filename.
Returns:
true if the file is found.

deleteDir

public static boolean deleteDir(File dir)
Deletes all files and subdirectories under dir. Returns true if all deletions were successful. If a deletion fails, the method stops attempting to delete and returns false.

Parameters:
dir - The directory to delete.
Returns:
True if deletion is succesfull.

loadLibrary

public static void loadLibrary(String libraryName)
                        throws LoadLibraryException
Throws:
LoadLibraryException


Copyright © 2004-2011. All Rights Reserved.