1 /* 2 Copyright (C) 2003 Grid Systems, S.A. 3 4 This program is free software; you can redistribute it and/or modify 5 it under the terms of the GNU General Public License, version 2, as 6 published by the Free Software Foundation. 7 8 This program is distributed in the hope that it will be useful, 9 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 GNU General Public License for more details. 12 13 You should have received a copy of the GNU General Public License 14 along with this program; if not, write to the Free Software 15 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 */ 17 package com.gridsystems.systemutils; 18 19 /** 20 * Utility methods. 21 * 22 * @author Xmas 23 * @version 1.0 24 */ 25 final class JNISystemUtils { 26 27 /** Private constructor. */ 28 private JNISystemUtils() { } 29 30 static { 31 // Extract from the jar the shared library for the host OS 32 Class myclass = com.gridsystems.systemutils.SystemUtils.class; 33 String lib = "SystemUtils"; 34 try { 35 com.gridsystems.utils.SystemUtils.extractDynamicLibrary(lib, myclass); 36 } catch (Exception ex) { 37 System.err.println("Cannot load SystemUtils dynamic library. Reason: \n"); 38 ex.printStackTrace(); 39 } 40 } 41 42 /** 43 * Gets the free disk space in the partition the specified file is located at. 44 * 45 * @param path File path 46 * @return Free disk space in MBytes 47 */ 48 static native long getFreeDiskSpace(String path); 49 50 /** 51 * Gets the total disk space in the partition the specified file is located at. 52 * 53 * @param path File path 54 * @return Total disk space in MBytes 55 */ 56 static native long getTotalDiskSpace(String path); 57 58 /** 59 * Gets the MAC Address of local machine. 60 * 61 * @return MAC address of local machine. 62 */ 63 static native String getLocalMacAddress(); 64 65 }