org.catacombae.jfuse.util
Class FUSEUtil

java.lang.Object
  extended by org.catacombae.jfuse.util.FUSEUtil

public class FUSEUtil
extends Object

Author:
erik

Constructor Summary
FUSEUtil()
           
 
Method Summary
static String basename(String path)
          Returns the last component of a pathname, just like the unix utility 'basename'.
static String decodeUTF8(byte[] utf8Data)
          Convenience method for decoding a UTF-8 byte array into a Java String.
static String decodeUTF8(ByteBuffer utf8Data)
          Convenience method for decoding a UTF-8 ByteBuffer into a Java String.
static String dirname(String path)
          Returns the directory component of a pathname, just like the unix utility 'dirname'.
static byte[] encodeUTF8(String str)
          Convenience method for encoding a UTF-8 byte string from a Java String.
static long getProcessGid()
          Returns the gid of the running Java process.
static long getProcessPid()
          Returns the pid of the running Java process.
static long getProcessUid()
          Returns the uid of the running Java process.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FUSEUtil

public FUSEUtil()
Method Detail

encodeUTF8

public static byte[] encodeUTF8(String str)
Convenience method for encoding a UTF-8 byte string from a Java String.

Parameters:
str - the string to encode.
Returns:
a UTF-8 encoded sequence containing the contents of 'str'.

decodeUTF8

public static String decodeUTF8(byte[] utf8Data)
Convenience method for decoding a UTF-8 byte array into a Java String.

Parameters:
utf8Data - the UTF-8 encoded string.
Returns:
a String containing the contents of 'utf8Data'.

decodeUTF8

public static String decodeUTF8(ByteBuffer utf8Data)
Convenience method for decoding a UTF-8 ByteBuffer into a Java String.

Parameters:
utf8Data - the UTF-8 encoded string.
Returns:
a String containing the contents of 'utf8Data'.

dirname

public static String dirname(String path)
Returns the directory component of a pathname, just like the unix utility 'dirname'.

Parameters:
path - the pathname to process. For example "/a/b/c".
Returns:
the path component. For example "/a/b".

basename

public static String basename(String path)
Returns the last component of a pathname, just like the unix utility 'basename'.

Parameters:
path - the pathname to process. For example "/a/b/c".
Returns:
the base component. For example "c".

getProcessUid

public static long getProcessUid()
Returns the uid of the running Java process.

Returns:
the uid of the running Java process.

getProcessGid

public static long getProcessGid()
Returns the gid of the running Java process.

Returns:
the gid of the running Java process.

getProcessPid

public static long getProcessPid()
Returns the pid of the running Java process.

Returns:
the pid of the running Java process.