org.walluck.oscar
Class AIMUtil

java.lang.Object
  extended byorg.walluck.oscar.AIMUtil

public class AIMUtil
extends java.lang.Object

AIM utilities.

Since:
1.0
Version:
1.0
Author:
David Walluck

Constructor Summary
AIMUtil()
           
 
Method Summary
static java.lang.String about()
          Print about information.
static byte[] byteArrayFromHexString(java.lang.String s)
          Turn a hex string into the corresponding byte array.
static java.lang.String byteArrayToHexString(byte[] b)
          Turn a byte array into the corresponding string.
static java.lang.String charsetAOLToJava(int charset)
          Given a short value indicating the charset code, return the corresponding Java string indicating the charset.
static java.lang.String charsetAOLToJava(java.lang.String charset)
          Given a string indicating the charset, return the corresponding Java string indicating the charset.
static java.lang.String convertHTMLToOSCAR(java.lang.String str)
          Convert from HTML to OSCAR markup
static java.lang.String convertOSCARToHTML(java.lang.String str)
          Convert from OSCAR markup to HTML
static java.lang.String dirAOLToSys(java.lang.String name)
          Convert an AOL style directory name to system.
static java.lang.String dirSysToAOL(java.lang.String name)
          Convert a system style directory name to AOL.
static java.lang.String extractRoomName(java.lang.String s)
          Extract the name from a Chat name.
static java.lang.String flapChannelToString(int channel)
          Print the plain-text description of a FLAP channel.
static java.lang.String getLibraryDate()
          Get the library date.
static java.lang.String getLibraryVersion()
          Get the library version.
static java.lang.String hexdump(byte[] data)
          Returns a string representing a hex dump of the given byte array.
static java.lang.String memInfo()
          Print Java runtime memory information before and after garbage collection.
static java.lang.String normalize(java.lang.String sn)
          Normalizes a screenname (removes spaces and lowercases all letters).
static java.lang.String parseProfileEncoding(java.lang.String enc)
          Parse a profile encoding string.
static java.lang.String prettyPrintTime(long time)
          Convert the time elapsed in milliseconds to a pretty string.
static java.lang.String snacErrorToString(int error)
          Return the plain-text description of a SNAC error.
static java.lang.String snacToString(int family, int subtype)
          Return the plain-text description of a SNAC given a family and subtype.
static boolean snCmp(java.lang.String sn1, java.lang.String sn2)
          Checks two given screennames for equality.
static int snLen(java.lang.String sn)
          Return the length of the given screenname (ignoring spaces).
static byte[] uuidToByteArray(java.lang.String uuid)
          This lets us turn a UUID (Universally Uninque Identifier) string into a byte array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AIMUtil

public AIMUtil()
Method Detail

getLibraryVersion

public static java.lang.String getLibraryVersion()
Get the library version.

Returns:
the library version

getLibraryDate

public static java.lang.String getLibraryDate()
Get the library date.

Returns:
the library date

snLen

public static int snLen(java.lang.String sn)
Return the length of the given screenname (ignoring spaces).

Parameters:
sn - the screenname
Returns:
the length of the screenname

normalize

public static java.lang.String normalize(java.lang.String sn)
Normalizes a screenname (removes spaces and lowercases all letters).

Parameters:
sn - the non-normalized screenname
Returns:
the screenname after it has been normalized

snCmp

public static boolean snCmp(java.lang.String sn1,
                            java.lang.String sn2)
Checks two given screennames for equality.

Parameters:
sn1 - the first screenname
sn2 - the second screenname
Returns:
true if the screennames are equal, false if the screennames are not equal

byteArrayFromHexString

public static byte[] byteArrayFromHexString(java.lang.String s)
Turn a hex string into the corresponding byte array.

Parameters:
s - the hex string to convert
Returns:
a byte array

byteArrayToHexString

public static java.lang.String byteArrayToHexString(byte[] b)
Turn a byte array into the corresponding string.

Parameters:
b - the byte array to convert
Returns:
a string

uuidToByteArray

public static byte[] uuidToByteArray(java.lang.String uuid)
This lets us turn a UUID (Universally Uninque Identifier) string into a byte array.

Parameters:
uuid - the UUID string
Returns:
the corresponding byte array

about

public static java.lang.String about()
Print about information.

Returns:
about information

memInfo

public static java.lang.String memInfo()
Print Java runtime memory information before and after garbage collection.

Returns:
memory information

flapChannelToString

public static java.lang.String flapChannelToString(int channel)
Print the plain-text description of a FLAP channel.

Parameters:
channel - the FLAP channel
Returns:
a String value

snacToString

public static java.lang.String snacToString(int family,
                                            int subtype)
Return the plain-text description of a SNAC given a family and subtype.

Parameters:
family - the SNAC family
subtype - the SNAC subtype
Returns:
the SNAC description

snacErrorToString

public static java.lang.String snacErrorToString(int error)
Return the plain-text description of a SNAC error.

Parameters:
error - the error code
Returns:
the SNAC error

extractRoomName

public static java.lang.String extractRoomName(java.lang.String s)
Extract the name from a Chat name. Looks like "!aol://number:number-number-name".

Parameters:
s - the Chat name
Returns:
the extracted name

dirAOLToSys

public static java.lang.String dirAOLToSys(java.lang.String name)
Convert an AOL style directory name to system.

Parameters:
name - the filename
Returns:
the directory with system separators

dirSysToAOL

public static java.lang.String dirSysToAOL(java.lang.String name)
Convert a system style directory name to AOL.

Parameters:
name - the filename
Returns:
the directory with AOL separators (0x01)

prettyPrintTime

public static java.lang.String prettyPrintTime(long time)
Convert the time elapsed in milliseconds to a pretty string.

Parameters:
time - the time elapsed in milliseconds
Returns:
the pretty string

hexdump

public static java.lang.String hexdump(byte[] data)
Returns a string representing a hex dump of the given byte array.

Parameters:
data - the byte array of the data you want to hex dump
Returns:
a string representing the hex dump of the given byte array

convertHTMLToOSCAR

public static java.lang.String convertHTMLToOSCAR(java.lang.String str)
Convert from HTML to OSCAR markup

Parameters:
str - the string to convert
Returns:
OSCAR markup

convertOSCARToHTML

public static java.lang.String convertOSCARToHTML(java.lang.String str)
Convert from OSCAR markup to HTML

Parameters:
str - the string to convert
Returns:
valid HTML

parseProfileEncoding

public static java.lang.String parseProfileEncoding(java.lang.String enc)
Parse a profile encoding string. For example, 'aol-rtf; charset="us-ascii"'.

Parameters:
enc - the profile encoding
Returns:
the AOL text encoding string, or "us-ascii" if none is found

charsetAOLToJava

public static java.lang.String charsetAOLToJava(int charset)
                                         throws java.io.UnsupportedEncodingException
Given a short value indicating the charset code, return the corresponding Java string indicating the charset.

Parameters:
charset - the short value indicating the charset
Returns:
the string representing the corresponding Java charset
Throws:
java.io.UnsupportedEncodingException - if an error occurs

charsetAOLToJava

public static java.lang.String charsetAOLToJava(java.lang.String charset)
                                         throws java.io.UnsupportedEncodingException
Given a string indicating the charset, return the corresponding Java string indicating the charset.

Parameters:
charset - the string indicating the charset
Returns:
the string representing the corresponding Java charset
Throws:
java.io.UnsupportedEncodingException - if an error occurs