public static OSFamily getOSFamily ( ) { String name = System . getProperty ( "os.name" ) . toLowerCase ( Locale . US ) ; if ( name . contains ( "windows" ) ) { if ( name . contains ( "95" ) || name . contains ( "98" ) || name . contains ( "me" ) || name . contains ( "ce" ) ) return OSFamily . win9x ; return OSFamily . windows ; } if ( name . contains ( "os/2" ) ) return OSFamily . os2 ; if ( name . contains ( "netware" ) ) return OSFamily . netware ; String sep = System . getProperty ( "path.separator" ) ; if ( sep . equals ( ";" ) ) return OSFamily . dos ; if ( name . contains ( "nonstop_kernel" ) ) return OSFamily . tandem ; if ( name . contains ( "openvms" ) ) return OSFamily . openvms ; if ( sep . equals ( ":" ) && ( ! name . contains ( "mac" ) || name . endsWith ( "x" ) ) ) return OSFamily . unix ; if ( name . contains ( "mac" ) ) return OSFamily . mac ; if ( name . contains ( "z/os" ) || name . contains ( "os/390" ) ) return OSFamily . zos ; if ( name . contains ( "os/400" ) ) return OSFamily . os400 ; return null ; }
Returns the type of operating system .