001/* 002 * Copyright (c) 2014 Maxim Yunusov 003 * Licensed under the Apache License, Version 2.0 (the "License"); 004 * you may not use this file except in compliance with the License. 005 * You may obtain a copy of the License at 006 * 007 * http://www.apache.org/licenses/LICENSE-2.0 008 * 009 * Unless required by applicable law or agreed to in writing, software 010 * distributed under the License is distributed on an "AS IS" BASIS, 011 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 012 * See the License for the specific language governing permissions and 013 * limitations under the License. 014 */ 015 016package org.maxur.perfmodel.backend.utils; 017 018/** 019 * @author Maxim 020 * @version 1.0 021 * @since <pre>08.11.2014</pre> 022 */ 023public final class OsUtils { 024 025 /** 026 * Util's class. 027 */ 028 private OsUtils() { 029 } 030 031 private static String getOsName() { 032 return System.getProperty("os.name").toLowerCase(); 033 } 034 035 public static boolean isWindows() { 036 return getOsName().indexOf("win") >= 0; 037 } 038 039 public static boolean isMac() { 040 return getOsName().indexOf("mac") >= 0; 041 } 042 043 public static boolean isUnix() { 044 return getOsName().indexOf("nix") >= 0 || getOsName().indexOf("nux") >= 0 || getOsName().indexOf("aix") > 0; 045 } 046 047 public static boolean isSolaris() { 048 return getOsName().indexOf("sunos") >= 0; 049 } 050 051}