com.gridsystems.systemutils
Class SystemUtils

java.lang.Object
  extended by com.gridsystems.systemutils.SystemUtils

public final class SystemUtils
extends java.lang.Object

Provides information of the disk units.

Author:
XMAS, SJM

Method Summary
static long getFreeDiskSpace(java.lang.String path)
          Gets the free disk space in the partition/unit to which the specified path belongs.
static java.lang.String getLocalMacAddress()
          Obtain Mac Address of local machine.
static long getTotalDiskSpace(java.lang.String path)
          Gets the total disk space in the partition/unit to which the specified path belongs.
static void main(java.lang.String[] args)
          Test program.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getFreeDiskSpace

public static long getFreeDiskSpace(java.lang.String path)
Gets the free disk space in the partition/unit to which the specified path belongs.

Parameters:
path - path to a file in the partition/unit whose space is requested.
WARNING: The path must point to an existing file. In Windows systems, it must point to a folder/directory, not to a regular file. To avoid cross-platform issues, it is advised to always use a path to a directory
Returns:
the free space in bytes, rounded down. 0 in case of error.

getTotalDiskSpace

public static long getTotalDiskSpace(java.lang.String path)
Gets the total disk space in the partition/unit to which the specified path belongs.

Parameters:
path - path to a file in the partition/unit whose space is requested.
WARNING: The path must point to an existing file. In Windows systems, it must point to a folder/directory, not to a regular file. To avoid cross-platform issues, it is advised to always use a path to a directory
Returns:
the total disk space in bytes, rounded down. 0 in case of error.

getLocalMacAddress

public static java.lang.String getLocalMacAddress()
                                           throws java.lang.Exception
Obtain Mac Address of local machine.

Returns:
MacAddress of local machine. If String starts with 'Error:', then the description of error is included in this string.
Throws:
java.lang.Exception - if error

main

public static void main(java.lang.String[] args)
Test program. Shows the total and free disk spaces in the working directory.

Parameters:
args - Unused.


Copyright © 2007-2008 Grid Systems, S.A.. All Rights Reserved.