当前位置: 首页>>代码示例>>Java>>正文


Java Platform.is64Bit方法代码示例

本文整理汇总了Java中com.sun.jna.Platform.is64Bit方法的典型用法代码示例。如果您正苦于以下问题:Java Platform.is64Bit方法的具体用法?Java Platform.is64Bit怎么用?Java Platform.is64Bit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.jna.Platform的用法示例。


在下文中一共展示了Platform.is64Bit方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getInstance

import com.sun.jna.Platform; //导入方法依赖的package包/类
/**
 * @return an instance of this class.
 */
public static NativeLibExporter getInstance() {
    if (instance == null) {
        instance = new NativeLibExporter();

        try {
            if (Platform.isMac())
                instance.exportLibrary("lib/darwin/libmediainfo.dylib");
            else if (Platform.isWindows() && Platform.is64Bit())
                instance.exportLibrary("lib/win64/MediaInfo64.dll");
            else if (Platform.isWindows())
                instance.exportLibrary("lib/win32/MediaInfo.dll");
        } catch (Throwable e) {
            System.err.println(e.getMessage());
        }
    }

    return instance;
}
 
开发者ID:MyCoRe-Org,项目名称:mycore,代码行数:22,代码来源:NativeLibExporter.java

示例2: getCurrentPhysicalMemory

import com.sun.jna.Platform; //导入方法依赖的package包/类
public long getCurrentPhysicalMemory()
{
	if (!isRunning())
		return -1;
	PdhCounter c = getPMemCounter();
	if (Platform.is64Bit())
		return c.getLongValue();
	return c.getIntValue();
}
 
开发者ID:yajsw,项目名称:yajsw,代码行数:10,代码来源:WindowsXPProcess.java

示例3: resolveNativeFile

import com.sun.jna.Platform; //导入方法依赖的package包/类
public static File resolveNativeFile(File parent, String fileName) {
    final File path = new File(parent, getPlatformFolder());

    String arch = Platform.is64Bit() ? "x86_64" : "x86";
    String prefix = isWinXp() ? "xp" : arch;

    if (new File(parent, prefix).exists()) {
        return new File(new File(parent, prefix), fileName);
    } else {
        return new File(new File(path, prefix), fileName);
    }
}
 
开发者ID:Coding,项目名称:WebIDE-Backend,代码行数:13,代码来源:PtyUtil.java

示例4: main

import com.sun.jna.Platform; //导入方法依赖的package包/类
public static void main(String[] args) {
	try {
		//check platform
		if (!Platform.isLinux()) {
			throw new IllegalStateException("Not a linux platform");
		}
		if (!Platform.is64Bit()) {
			throw new IllegalStateException("Not a 64bit platform");
		}
		//bump max open files limit
		int procMax = Integer.parseInt(Files.readAllLines(new File("/proc/sys/fs/nr_open").toPath()).get(0));
		ResourceLimit rlimit = new ResourceLimit();
		rlimit.rlim_cur = procMax;
		rlimit.rlim_max = procMax;
		CLibrary.setrlimit(CLibrary.RLIMIT_NOFILE, rlimit);
		//bump max mmap count
		BufferedWriter maxMapCountStream = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File("/proc/sys/vm/max_map_count"))));
		maxMapCountStream.write(String.valueOf(Integer.MAX_VALUE));
		maxMapCountStream.close();
		//infinite sleep thread, doens't allow program to close if no folders configured
		new InfiniteSleeperThread().start();
		//start watching directories
		DirectoryList list = new DirectoryList();
		list.load("dirlist");
		for (File directory : list.getList()) {
			new DirectoryWatchService(directory).start();
		}
		for (String arg : args) {
			new DirectoryWatchService(new File(arg)).start();
		}
	} catch (Throwable t) {
		ExceptionShutdown.shutdown("Exception while initializing", t);
	}
}
 
开发者ID:Shevchik,项目名称:DirectoryCacher,代码行数:35,代码来源:DirectoryCacher.java

示例5: getArchType

import com.sun.jna.Platform; //导入方法依赖的package包/类
public static String getArchType() {
    if (Platform.is64Bit()) {
        return "64-bit";
    } else {
        return "32-bit";
    }
}
 
开发者ID:jocopa3,项目名称:BlocktopographPC-GUI,代码行数:8,代码来源:Main.java

示例6: setupNatives

import com.sun.jna.Platform; //导入方法依赖的package包/类
public static void setupNatives() {
    if (!checkIsOSSupported()) {
        JOptionPane.showMessageDialog(null, "Sorry, " + getArchType() + " " + System.getProperty("os.name") + " is not supported!", "Unsupported OS", JOptionPane.ERROR_MESSAGE);
        System.exit(0);
    }

    String nativesFolder = File.separator + "natives" + File.separator;
    String suffix = Platform.is64Bit() ? "x64" : "x86";

    switch(Platform.getOSType()) {
        case Platform.WINDOWS:
            nativesFolder += "windows";
            break;
        case Platform.MAC:
            nativesFolder += "mac";
            break;
        case Platform.LINUX:
            nativesFolder += "linux";
            break;
        case Platform.FREEBSD:
            nativesFolder += "freebsd";
            break;
        case Platform.OPENBSD:
            nativesFolder += "openbsd";
            break;
    }
    
    nativesFolder += File.separator + suffix + File.separator;
    
    String nativesFolderPath = (new File(Main.class.getProtectionDomain().getCodeSource().getLocation().getPath()).getParentFile()).getPath() + nativesFolder;
    
    //System.out.println((new File(Main.class.getProtectionDomain().getCodeSource().getLocation().getPath()).getParentFile()).getPath() + nativesFolder);
    
    if(!new File(nativesFolderPath).exists()) {
        //JOptionPane.showMessageDialog(null, "Could not find natives folder: " + nativesFolder, "No Natives Found", JOptionPane.ERROR_MESSAGE);
        //System.exit(0);
    }
    
    NativeLibrary.addSearchPath("leveldb", nativesFolderPath);
}
 
开发者ID:jocopa3,项目名称:BlocktopographPC-GUI,代码行数:41,代码来源:Main.java

示例7: getCurrentOSAndArchString

import com.sun.jna.Platform; //导入方法依赖的package包/类
public static String getCurrentOSAndArchString() {
	String os = System.getProperty("os.name"), arch = System.getProperty("os.arch");

	if (os.equals("Mac OS X")) {
		os = "darwin";
		arch = "fat";
		//arch = Platform.is64Bit() ? "64" : "32";
	} else if (os.startsWith("Windows")) {
		return "win" + (Platform.is64Bit() ? "64" : "32");
	} else if (os.matches("SunOS|Solaris"))
		os = "solaris";
	
	return os + "-" + arch;
}
 
开发者ID:nativelibs4java,项目名称:JNAerator,代码行数:15,代码来源:LibraryExtractor.java

示例8: resolveNativeFile

import com.sun.jna.Platform; //导入方法依赖的package包/类
public static File resolveNativeFile(File parent, String fileName) {
  final File path = new File(parent, getPlatformFolder());

  String arch = Platform.is64Bit() ? "x86_64" : "x86";
  String prefix = isWinXp() ? "xp" : arch;

  if (new File(parent, prefix).exists()) {
    return new File(new File(parent, prefix), fileName);
  } else {
    return new File(new File(path, prefix), fileName);
  }
}
 
开发者ID:traff,项目名称:pty4j,代码行数:13,代码来源:PtyUtil.java

示例9: getPr_size

import com.sun.jna.Platform; //导入方法依赖的package包/类
long getPr_size()
{
	if (Platform.is64Bit())
		return _b.getLong(44);
	return _b.getInt(44);
}
 
开发者ID:yajsw,项目名称:yajsw,代码行数:7,代码来源:SolarisProcess.java

示例10: testExecutable

import com.sun.jna.Platform; //导入方法依赖的package包/类
@Override
public @Nullable ExecutableInfo testExecutable(@Nonnull ExecutableInfo executableInfo) {
	executableInfo = testExecutableFile(executableInfo);
	if (Boolean.FALSE.equals(executableInfo.getAvailable())) {
		return executableInfo;
	}
	final String arg = "-v";
	ExecutableInfoBuilder result = executableInfo.modify();
	try {
		ListProcessWrapperResult output = SimpleProcessWrapper.runProcessListOutput(
			30000,
			1000,
			executableInfo.getPath().toString(),
			arg
		);
		if (output.getError() != null) {
			result.errorType(ExecutableErrorType.GENERAL);
			result.errorText(String.format(Messages.getString("Engine.Error"), this) + " \n" + output.getError().getMessage());
			result.available(Boolean.FALSE);
			LOGGER.debug("\"{} {}\" failed with error: {}", executableInfo.getPath(), arg, output.getError().getMessage());
			return result.build();
		}
		if (output.getExitCode() == 0) {
			if (output.getOutput() != null && output.getOutput().size() > 0) {
				Pattern pattern = Pattern.compile("tsMuxeR\\.\\s+Version\\s(\\S+)\\s+", Pattern.CASE_INSENSITIVE);
				Matcher matcher = pattern.matcher(output.getOutput().get(0));
				if (matcher.find() && isNotBlank(matcher.group(1))) {
					result.version(new Version(matcher.group(1)));
				}
			}
			result.available(Boolean.TRUE);
		} else {
			NTStatus ntStatus = Platform.isWindows() ? NTStatus.typeOf(output.getExitCode()) : null;
			if (ntStatus != null) {
				result.errorType(ExecutableErrorType.GENERAL);
				result.errorText(String.format(Messages.getString("Engine.Error"), this) + "\n\n" + ntStatus);
			} else {
				result.errorType(ExecutableErrorType.GENERAL);
				result.errorText(String.format(Messages.getString("Engine.ExitCode"), this, output.getExitCode()));
				if (Platform.isLinux() && Platform.is64Bit()) {
					result.errorType(ExecutableErrorType.GENERAL);
					result.errorText(result.errorText() + ". \n" + Messages.getString("Engine.tsMuxerErrorLinux"));
				}
				result.available(Boolean.FALSE);
			}
		}
	} catch (InterruptedException e) {
		return null;
	}
	return result.build();
}
 
开发者ID:DigitalMediaServer,项目名称:DigitalMediaServer,代码行数:52,代码来源:TsMuxeRVideo.java

示例11: readFileNameFromInput

import com.sun.jna.Platform; //导入方法依赖的package包/类
private String readFileNameFromInput(LPARAM lParam) {
    Class structPlatformClass = (Platform.is64Bit()) ? PuttyStruct64.class : PuttyStruct32.class;
    PuttyStruct ps = (PuttyStruct) PuttyStruct.newInstance(structPlatformClass, new Pointer(lParam.longValue()));
    ps.read();
    return new String(ps.lpData.getString(0).getBytes(Charset.forName("US-ASCII")));
}
 
开发者ID:martin-lizner,项目名称:trezor-ssh-agent,代码行数:7,代码来源:SSHAgent.java

示例12: loadMediaInfo

import com.sun.jna.Platform; //导入方法依赖的package包/类
/**
 * load media info from /native/*
 */
public static void loadMediaInfo() {
  try {
    String miv = "";

    // dropped linux shipment
    if (!Platform.isLinux()) {
      String nativepath = "native/";

      // windows
      if (Platform.isWindows()) {
        nativepath += "windows";
      }
      // linux
      else if (Platform.isLinux()) {
        nativepath += "linux";
      }
      // osx
      else if (Platform.isMac()) {
        nativepath += "mac";
      }

      // mac uses the same lib for 32 and 64 bit
      if (!Platform.isMac()) {
        // https://en.wikipedia.org/wiki/X86-64
        if (Platform.is64Bit()) {
          nativepath += "-x64";
        }
        else {
          nativepath += "-x86";
        }
      }

      // need that, since we cannot try and reload/unload a Class
      // MI does not load over UNC, so copy to temp
      if (System.getProperty("user.dir", "").startsWith("\\\\") || System.getProperty("user.dir", "").startsWith("//")) {
        LOGGER.debug("We're on a network UNC path!");
        File tmpDir = new File(System.getProperty("java.io.tmpdir"), "tmm");
        File nativeDir = new File(tmpDir, nativepath);
        FileUtils.copyDirectory(new File(nativepath), nativeDir);

        System.setProperty("jna.library.path", nativeDir.getAbsolutePath());
        LOGGER.debug("Loading native mediainfo lib from: {}", nativeDir.getAbsolutePath());
        miv = MediaInfo.version(); // load class
      }
      else {
        System.setProperty("jna.library.path", nativepath);
        LOGGER.debug("Loading native mediainfo lib from: {}", nativepath);
        miv = MediaInfo.version(); // load class
      }
    }
    else {
      miv = MediaInfo.version(); // load class
    }

    if (!StringUtils.isEmpty(miv)) {
      LOGGER.info("Using " + miv);
    }
    else {
      LOGGER.error("could not load MediaInfo!");
      if (Platform.isLinux()) {
        LOGGER.error("Please try do install the library from your distribution");
      }
    }

  }
  catch (

  IOException e)

  {
    LOGGER.error("Could not load mediainfo", e);
  }
}
 
开发者ID:tinyMediaManager,项目名称:tinyMediaManager,代码行数:77,代码来源:MediaInfoUtils.java

示例13: getOSBitness

import com.sun.jna.Platform; //导入方法依赖的package包/类
/**
 * Determines whether the operating system is 64-bit or 32-bit.
 *
 * XXX This will work with Windows and OS X but not necessarily with Linux
 * as we're relying on Java's {@code os.arch} which only detects the bitness
 * of the JVM, not of the operating system. If <a
 * href="https://github.com/oshi/oshi/issues/377">OSHI #377</a> is
 * implemented, it could be a reliable source for all OSes.
 *
 * @return The bitness of the operating system.
 */
public static int getOSBitness() {
	if (Platform.isWindows()) {
		return System.getenv("ProgramFiles(x86)") != null ? 64 : 32;
	}
	return Platform.is64Bit() ? 64 : 32;
}
 
开发者ID:DigitalMediaServer,项目名称:DigitalMediaServer,代码行数:18,代码来源:SystemInformation.java


注:本文中的com.sun.jna.Platform.is64Bit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。