edu.vt.middleware.ldap
Class LdapUtil

java.lang.Object
  extended by edu.vt.middleware.ldap.LdapUtil

public final class LdapUtil
extends Object

LdapUtil provides helper methods for Ldap.

Version:
$Revision: 1330 $ $Date: 2010-05-23 18:10:53 -0400 (Sun, 23 May 2010) $
Author:
Middleware Services

Method Summary
static byte[] base64Decode(String value)
          This will decode the supplied value as a base64 encoded string to a byte[].
static String base64Encode(byte[] value)
          This will convert the supplied value to a base64 encoded string.
static String base64Encode(String value)
          This will convert the supplied value to a base64 encoded string.
static boolean checkCredential(Object credential)
          This checks a credential to ensure it is the right type and it is not empty.
static byte[] readInputStream(InputStream is)
          Reads the data in the supplied stream and returns it as a byte array.
static byte[] readURL(URL url)
          Reads the data at the supplied URL and returns it as a byte array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

checkCredential

public static boolean checkCredential(Object credential)
This checks a credential to ensure it is the right type and it is not empty. A credential can be of type String, char[], or byte[].

Parameters:
credential - Object to check
Returns:
boolean - whether the credential is valid

base64Encode

public static String base64Encode(byte[] value)
This will convert the supplied value to a base64 encoded string. Returns null if the bytes cannot be encoded.

Parameters:
value - byte[] to base64 encode
Returns:
String

base64Encode

public static String base64Encode(String value)
This will convert the supplied value to a base64 encoded string. Returns null if the string cannot be encoded.

Parameters:
value - String to base64 encode
Returns:
String

base64Decode

public static byte[] base64Decode(String value)
This will decode the supplied value as a base64 encoded string to a byte[].

Parameters:
value - Object to base64 encode
Returns:
String

readURL

public static byte[] readURL(URL url)
                      throws IOException
Reads the data at the supplied URL and returns it as a byte array.

Parameters:
url - URL to read
Returns:
byte[] read from URL
Throws:
IOException - if an error occurs reading data

readInputStream

public static byte[] readInputStream(InputStream is)
                              throws IOException
Reads the data in the supplied stream and returns it as a byte array.

Parameters:
is - InputStream to read
Returns:
byte[] read from the stream
Throws:
IOException - if an error occurs reading data


Copyright © 2003-2010 Virginia Tech. All Rights Reserved.