java-jna-内联汇编-Lib

https://blog.csdn.net/weixin_34018169/article/details/89982906


package sample.ASM;


/**
 * 
 * Copyright 2008
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 * 
 * @project loonframework
 * @author chenpeng
 * @email:ceponline@yahoo.com.cn
 * @version 0.1
 */
public class Lib {
	
	final static public String PS = System.getProperty("path.separator");

	final static public String LS = System.getProperty("line.separator", "\n");

	final static public String FS = System.getProperty("file.separator", "\\");

	final static private boolean osIsMacOsX;

	final static private boolean osIsWindows;

	final static private boolean osIsWindowsXP;

	final static private boolean osIsWindows2003;

	final static public String LOON_OS_NAME;

	final static public int JAVA_13 = 0;

	final static public int JAVA_14 = 1;

	final static public int JAVA_15 = 2;

	final static public int JAVA_16 = 3;

	final static public int JAVA_17 = 4;

	private static String javaVersion;

	final static private float majorJavaVersion = getMajorJavaVersion(System
			.getProperty("java.specification.version"));

	private static int tmpmajor = 0;

	final static private float DEFAULT_JAVA_VERSION = 1.3f;
	static {

		LOON_OS_NAME = System.getProperty("os.name").toLowerCase();
		osIsMacOsX = "mac os x".equals(LOON_OS_NAME);
		osIsWindows = LOON_OS_NAME.indexOf("windows") != -1;
		osIsWindowsXP = "windows xp".equals(LOON_OS_NAME);
		osIsWindows2003 = "windows 2003".equals(LOON_OS_NAME);

		javaVersion = System.getProperty("java.version");

		if (javaVersion.indexOf("1.4.") != -1) {
			tmpmajor = JAVA_14;
		} else if (javaVersion.indexOf("1.5.") != -1) {
			tmpmajor = JAVA_15;
		} else if (javaVersion.indexOf("1.6.") != -1) {
			tmpmajor = JAVA_16;
		} else if (javaVersion.indexOf("1.7.") != -1) {
			tmpmajor = JAVA_17;
		} else {
			tmpmajor = JAVA_13;
		}

	}

	public static boolean isOverrunJdk14() {
		return tmpmajor > JAVA_14;
	}

	public static boolean isMacOSX() {
		return osIsMacOsX;
	}

	public static boolean isWindows() {
		return osIsWindows;
	}

	public static boolean isWindowsXP() {
		return osIsWindowsXP;
	}

	public static boolean isWindows2003() {
		return osIsWindows2003;
	}

	final static private float getMajorJavaVersion(String javaVersion) {
		try {
			return Float.parseFloat(javaVersion.substring(0, 3));
		} catch (NumberFormatException e) {
			return DEFAULT_JAVA_VERSION;
		}
	}

	public static boolean isJDK13() {
		return majorJavaVersion == DEFAULT_JAVA_VERSION;
	}

	public static boolean isJDK14() {
		return majorJavaVersion == 1.4f;
	}

	public static boolean isJDK15() {
		return majorJavaVersion == 1.5f;
	}

	public static boolean isJDK16() {
		return majorJavaVersion == 1.6f;
	}

	public static boolean isJDK17() {
		return majorJavaVersion == 1.7f;
	}

	public static boolean isSun() {
		return System.getProperty("java.vm.vendor").indexOf("Sun") != -1;
	}

	public static boolean isApple() {
		return System.getProperty("java.vm.vendor").indexOf("Apple") != -1;
	}

	public static boolean isHPUX() {
		return System.getProperty("java.vm.vendor").indexOf(
				"Hewlett-Packard Company") != -1;
	}

	public static boolean isIBM() {
		return System.getProperty("java.vm.vendor").indexOf("IBM") != -1;
	}

	public static boolean isBlackdown() {
		return System.getProperty("java.vm.vendor").indexOf("Blackdown") != -1;
	}

	public static boolean isBEAWithUnsafeSupport() {
		if (System.getProperty("java.vm.vendor").indexOf("BEA") != -1) {
			String vmVersion = System.getProperty("java.vm.version");
			if (vmVersion.startsWith("R")) {
				return true;
			}
			String vmInfo = System.getProperty("java.vm.info");
			if (vmInfo != null) {

				return (vmInfo.startsWith("R25.1") || vmInfo
						.startsWith("R25.2"));
			}
		}

		return false;
	}

	public static String getJavaVersion() {
		return javaVersion;
	}

	public static int getMajorJavaVersion() {
		return tmpmajor;
	}

	
}


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值