ariba.util.core
Class ServerUtil

java.lang.Object
  extended by ariba.util.core.ServerUtil

public class ServerUtil
extends Object


Field Summary
static String HTTPSProxyPassword
           
static boolean isMicrosoftVM
           
static boolean isUnix
           
static boolean isWin32
           
static boolean isWin32Enabled
          Useful for asking if it is legal to call a win32 specific api
static boolean UseSecureRandomNumberGenerator
           
 
Constructor Summary
ServerUtil()
           
 
Method Summary
static boolean compareFilenames(String firstFilename, String secondFilename)
           
static boolean compareInputStreams(InputStream firstStream, InputStream secondStream)
           
static boolean compareInputStreams(InputStream firstStream, InputStream secondStream, byte[] buffer1, byte[] buffer2)
           
static List fileExtension(String mimeType)
          Returns the list of file extension names for the given mime type.
static String filterMapValue(Map map, String key, char fillChar)
          filterValue is useful for dumping out a Map for display in which a particular key's value is not suitable for display (e.g.
static String filterMapValue(String input, String filterKey, char fillChar)
          Params: input: a string, assumed to be a result of Map.toString() filterKey: the key for which the value is to be "filtered" fillChar: the value for which the value is to be overwritten Returns null if the key was not found
static String mimeType(String fileExtension)
           
static String mimeType(String currentType, String fileExtension)
          if we don't have a current type or the current type is the default, then try to map it by file extension.
static int nextRandomInt()
           
static long nextRandomLong()
           
static int nextSecureInt()
           
static long nextSecureLong()
           
static int parseInt(char[] charArray, int charArrayLength)
          Assuming the specified charArray represents an integer, returns that integer's value.
static int parseInt(char[] charArray, int charArrayLength, int radix)
          Assuming the specified charArray represents an integer, returns that integer's value.
static int parseInt(int offset, int scanLength, char[] charArray, int charArrayLength)
          Assuming the specified charArray represents an integer, returns that integer's value.
static int parseInt(int offset, int scanLength, char[] charArray, int charArrayLength, int radix)
          Assuming the specified charArray represents an integer, returns that integer's value.
static String quoteQuotes(String s, char quote)
          Rewrite 's' expanding each occurrence of character 'quote' with two of the same.
static Random randomNumberGenerator()
           
static Random secureRandomNumberGenerator()
           
static void setSystemProperty(String key, String value)
           
static String[] simpleParse(String line, String delimeter)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HTTPSProxyPassword

public static final String HTTPSProxyPassword
See Also:
Constant Field Values

isWin32

public static final boolean isWin32

isUnix

public static final boolean isUnix

isMicrosoftVM

public static final boolean isMicrosoftVM

isWin32Enabled

public static final boolean isWin32Enabled
Useful for asking if it is legal to call a win32 specific api


UseSecureRandomNumberGenerator

public static boolean UseSecureRandomNumberGenerator
Constructor Detail

ServerUtil

public ServerUtil()
Method Detail

quoteQuotes

public static String quoteQuotes(String s,
                                 char quote)
Rewrite 's' expanding each occurrence of character 'quote' with two of the same.


compareFilenames

public static boolean compareFilenames(String firstFilename,
                                       String secondFilename)

compareInputStreams

public static boolean compareInputStreams(InputStream firstStream,
                                          InputStream secondStream)

compareInputStreams

public static boolean compareInputStreams(InputStream firstStream,
                                          InputStream secondStream,
                                          byte[] buffer1,
                                          byte[] buffer2)

mimeType

public static String mimeType(String currentType,
                              String fileExtension)
if we don't have a current type or the current type is the default, then try to map it by file extension.


mimeType

public static String mimeType(String fileExtension)

fileExtension

public static List fileExtension(String mimeType)
Returns the list of file extension names for the given mime type. It could return null or empty list on a not matched case.

Parameters:
mimeType - the mime type
Returns:
the mapped list of file extension names.
See Also:
Mapping.reverseMap

setSystemProperty

public static void setSystemProperty(String key,
                                     String value)

filterMapValue

public static String filterMapValue(Map map,
                                    String key,
                                    char fillChar)
filterValue is useful for dumping out a Map for display in which a particular key's value is not suitable for display (e.g. contains a password).


filterMapValue

public static String filterMapValue(String input,
                                    String filterKey,
                                    char fillChar)
Params: input: a string, assumed to be a result of Map.toString() filterKey: the key for which the value is to be "filtered" fillChar: the value for which the value is to be overwritten Returns null if the key was not found


simpleParse

public static String[] simpleParse(String line,
                                   String delimeter)

parseInt

public static int parseInt(int offset,
                           int scanLength,
                           char[] charArray,
                           int charArrayLength)
                    throws NumberFormatException
Assuming the specified charArray represents an integer, returns that integer's value. Throws an exception if the charArray cannot be parsed as an int.

Throws:
NumberFormatException - If the charArray does not contain a parsable integer.

parseInt

public static int parseInt(char[] charArray,
                           int charArrayLength,
                           int radix)
                    throws NumberFormatException
Assuming the specified charArray represents an integer, returns that integer's value. Throws an exception if the charArray cannot be parsed as an int.

Throws:
NumberFormatException - If the charArray does not contain a parsable integer.

parseInt

public static int parseInt(char[] charArray,
                           int charArrayLength)
                    throws NumberFormatException
Assuming the specified charArray represents an integer, returns that integer's value. Throws an exception if the charArray cannot be parsed as an int.

Throws:
NumberFormatException - If the charArray does not contain a parsable integer.

parseInt

public static int parseInt(int offset,
                           int scanLength,
                           char[] charArray,
                           int charArrayLength,
                           int radix)
                    throws NumberFormatException
Assuming the specified charArray represents an integer, returns that integer's value. Throws an exception if the charArray cannot be parsed as an int.

Throws:
NumberFormatException - If the charArray does not contain a parsable integer.

secureRandomNumberGenerator

public static final Random secureRandomNumberGenerator()

nextSecureInt

public static final int nextSecureInt()

nextSecureLong

public static final long nextSecureLong()

randomNumberGenerator

public static final Random randomNumberGenerator()

nextRandomInt

public static final int nextRandomInt()

nextRandomLong

public static final long nextRandomLong()


AribaWeb User Interface Development Framework
Copyright © 2000-2009 Ariba, Inc. All Rights Reserved.