|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--inria.util.Utilities
Static methods providing common utilities.
Field Summary | |
protected static java.net.InetAddress |
localhost
|
protected static java.lang.String |
localHostName
|
static long |
Modulo32
|
Constructor Summary | |
Utilities()
|
Method Summary | |
static java.lang.String |
basename(java.lang.String filename)
Returns the base name from a file name. |
static boolean |
bcomp(byte[] v1,
byte[] v2)
does a byte compare. |
static int |
byteToInt(byte[] buff,
int offset)
Get integer value from a byte array. |
static long |
byteToLong(byte[] buff,
int offset)
Get long value from a byte array. |
static java.lang.String |
convertPathname(java.lang.String filename)
converts a file path name appropriate to the platform. |
static int |
diff32(int seq1,
int seq2)
does 32-bit diff of seqno (seq1 - seq2). |
static java.lang.String |
dirname(java.lang.String filename)
Returns the dir name from a file name. |
static java.lang.String |
fileExtension(java.lang.String filename)
gets extension string of a file name. |
static java.lang.String |
getHttpRoot(java.lang.String url)
gets root http url, something like http://a.b.c |
static java.net.InetAddress |
getLocalHost()
gets the local host address. |
static java.lang.String |
getLocalHostName()
gets the local host address. |
static double |
getRandomDouble()
returns a random integer using the default seed. |
static int |
getRandomInteger()
returns a random integer using the default seed. |
static int |
getShort(byte[] buf,
int offset)
Get short value from a byte array. |
static java.lang.String |
getURLRoot(java.lang.String url)
gets the root of url, something like proto://a.b.c |
static java.lang.String |
GMTDate(long t)
returns a string representation of the time using GMT. |
static void |
intToByte(int i,
byte[] buff,
int offset)
Put an integer value into a byte array in the MSBF order. |
static boolean |
isValidURL(java.lang.String url)
Check if the url is valid. |
static java.lang.String |
localDate(long t)
returns a string representation of the time using the default locale. |
static int |
pad32(byte[] buff,
int offset)
pad a byte buffer so that it contains an integer number of 32 bit word. |
static long |
parseGenericDate(java.lang.String s)
parses the date string in standard format, i.e., Sun, 06 Nov 1994 08:49:37 GMT --- RFC 822, updated by RFC 1123 Sunday, 06-Nov-94 08:49:37 GMT --- RFC 850, obsoleted by RFC 1036 Sun Nov 6 08:49:37 1994 --- ANSI C's asctime() format |
static java.lang.String |
shortDate(long t)
returns a string representation of the time using the default locale. |
static java.lang.String |
shortDateWithWeekday(long t)
returns a string representation of the time using the default locale. |
static java.lang.String |
shortPathname(java.lang.String s)
Remove ./ and ../ from pathname. |
static java.util.Vector |
sortByString(java.util.Vector tab,
boolean ignoreCase)
sorts the given table by characters. |
static java.lang.String |
toAddressString(int addr)
converts int to INET address string. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final long Modulo32
protected static java.net.InetAddress localhost
protected static java.lang.String localHostName
Constructor Detail |
public Utilities()
Method Detail |
public static java.lang.String getLocalHostName()
public static java.net.InetAddress getLocalHost()
public static java.lang.String fileExtension(java.lang.String filename)
filename
- the file pathname.public static java.lang.String convertPathname(java.lang.String filename)
filename
- the file pathname.public static java.lang.String shortPathname(java.lang.String s)
s
- the file pathname or http URL string.public static java.lang.String dirname(java.lang.String filename)
filename
- the file pathname.public static java.lang.String basename(java.lang.String filename)
filename
- the file pathname.public static java.lang.String getURLRoot(java.lang.String url)
url
- the absolute url.public static java.lang.String getHttpRoot(java.lang.String url)
url
- absolute url.public static void intToByte(int i, byte[] buff, int offset)
i
- the integer value.buff
- the byte array.offset
- the offset in the array to put the integer.public static int byteToInt(byte[] buff, int offset)
buff
- the byte array.offset
- the offset in the array.public static long byteToLong(byte[] buff, int offset)
buff
- the byte array.offset
- the offset in the array.public static int getShort(byte[] buf, int offset)
buff
- the byte array.offset
- the offset in the array.public static boolean isValidURL(java.lang.String url)
url
- the URL string.public static java.lang.String toAddressString(int addr)
addr
- 32 bit address values.public static int pad32(byte[] buff, int offset)
public static int diff32(int seq1, int seq2)
seq1
- first seqno.seq2
- second seqno.public static boolean bcomp(byte[] v1, byte[] v2)
v1
- the first byte array.v1
- the second byte array.public static java.util.Vector sortByString(java.util.Vector tab, boolean ignoreCase)
tab
- the table to sort.ignoreCase
- if true, ingore case while comparing characters.public static int getRandomInteger()
public static double getRandomDouble()
public static java.lang.String GMTDate(long t)
public static java.lang.String localDate(long t)
public static java.lang.String shortDateWithWeekday(long t)
public static java.lang.String shortDate(long t)
public static long parseGenericDate(java.lang.String s)
s
- the date string.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
JavaTM Reliable MulticastTM Service version 1.1
Copyright (c) 2001, Sun Microsystems Laboratories, All rights reserved.