Esri Geoportal Server
1.0

com.esri.gpt.server.csw.client
Class Utils

java.lang.Object
  extended by com.esri.gpt.server.csw.client.Utils

public class Utils
extends Object

The Class Utils. Utility class. Cannot be instantiated. All methods will be static


Field Summary
static Logger LOG
          Class Logger
 
Method Summary
static double chkDbl(String s, double defaultVal)
          Converts a string to a double value.
static int chkInt(String s, int defaultVal)
          Chk int.
static String chkStr(String string)
          If string is null, returns empty string, else returns trimmed string.
static void close(InputStream inStream)
          Close InputStream.
static void close(OutputStream oStream)
          Close OutputStream.
static void close(Reader reader)
          Close a reader input .
static String getInputString(BufferedInputStream bIStream)
          Gets the input string from an InputStream.
static String getInputString2(InputStream inputStream)
          Gets the input string2.
static boolean isUrl(Object obj)
          Checks if is url.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

public static Logger LOG
Class Logger

Method Detail

chkStr

public static String chkStr(String string)
If string is null, returns empty string, else returns trimmed string.

Parameters:
string - the string to be checked
Returns:
the string (trimmed, never null)

chkDbl

public static double chkDbl(String s,
                            double defaultVal)
Converts a string to a double value.

Parameters:
s - the string to convert
defaultVal - the default value to return if the string is invalid
Returns:
the converted value

chkInt

public static int chkInt(String s,
                         int defaultVal)
Chk int.

Parameters:
s - The string value to be checked
defaultVal - the default val
Returns:
the int

getInputString

public static String getInputString(BufferedInputStream bIStream)
Gets the input string from an InputStream. InputStream is left open and in the beginning so make sure to close it once done.

Parameters:
bIStream - the input Stream. Will not be closed after function and will be available for reading
Returns:
the input string TODO: BUFFER_BYTES were increased because the BufferedInputStream buffer was getting overun.

getInputString2

public static String getInputString2(InputStream inputStream)
                              throws IOException
Gets the input string2.

Parameters:
inputStream - the input stream. Will be closed after function.
Returns:
the input string2
Throws:
IOException - Signals that an I/O exception has occurred.

isUrl

public static boolean isUrl(Object obj)
Checks if is url.

Parameters:
obj - the obj (toString method will be called)
Returns:
true, if is url

close

public static void close(InputStream inStream)
Close InputStream.

Parameters:
inStream - the input Stream

close

public static void close(OutputStream oStream)
Close OutputStream.

Parameters:
oStream - the input Stream

close

public static void close(Reader reader)
Close a reader input .

Parameters:
reader - the reader

Esri Geoportal Server
1.0

Copyright 2011 Environmental Systems Research Institute. All rights reserved. Use is subject to license terms.