Utilities
Class Functions

public class Functions

Title:Utilities

Description: Contains the Utility functions like conversion of bytes to strings etc..

Copyright: Copyright (c) 2004

Company: CSI5321

Version:
1.0
Author:
Arun Chokkalingam
Method Detail

getHostName

public static final java.lang.String getHostName()
Finds the IP address of the machine
Returns:
String

getPortNumber

public static final java.lang.String getPortNumber()
Returns the port number that the client will listen to
Returns:
String

getLeft

public static final java.lang.String getLeft()
returns the left value in constants as a String
Returns:

getUploaded

public static final java.lang.String getUploaded()
returns the uploaded value in constants as a String
Returns:

convertBytesToString

public static java.lang.String convertBytesToString(java.lang.Object value)
COnverts the Bytes to String using the Byte Encoding
Parameters:
value - Object
Returns:
String

doEncoding

public static java.lang.String doEncoding(java.lang.String s)
URLEncode a given string and return it
Parameters:
s - String
Returns:
String

convertMsgBytes

public static byte[] convertMsgBytes(java.lang.String s)
COnvert a string to ByteArray
Parameters:
s - String
Returns:
byte[]

comp

public static java.lang.String comp(byte mask,
                                    byte b)
Compare two bytes and return OR them and return the result as a string
Parameters:
mask - byte
b - byte
Returns:
String

getBinary

public static java.lang.String getBinary(byte b)
Converts a binary string of a given byte
Parameters:
b - byte
Returns:
String

getByteBitField

public static byte[] getByteBitField()
This function converts the stored bit field to bytes. This is the reverse of the getBinary Function
Parameters:
bitFld -
Returns:

setBitAt

private static byte setBitAt(byte a,
                             int pos)
This function clears the bit at the position pos of the byte a and returns the new byte
Parameters:
a -
pos -
Returns:

convertStringToArray

public static int[] convertStringToArray(java.lang.String bitField)
Converts a string to an array
Parameters:
bitField - String
Returns:
int[]

convertHexStringToByte

public static byte[] convertHexStringToByte(java.lang.String hex)
Converts a Hexadecimal string to byteArray
Parameters:
hex - String
Returns:
byte[]
Throws:
UnsupportedEncodingException -
Author:
Got From the Internet