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


Java Memory.clear方法代码示例

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


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

示例1: getNoteClass

import com.sun.jna.Memory; //导入方法依赖的package包/类
/**
 * Returns the note class of the note
 * 
 * @return note class
 */
public EnumSet<NoteClass> getNoteClass() {
	if (m_noteClass==null) {
		checkHandle();
		
		Memory retNoteClass = new Memory(2);
		retNoteClass.clear();
		
		if (PlatformUtils.is64Bit()) {
			NotesNativeAPI64.get().NSFNoteGetInfo(m_hNote64, NotesConstants._NOTE_CLASS, retNoteClass);
		}
		else {
			NotesNativeAPI32.get().NSFNoteGetInfo(m_hNote32, NotesConstants._NOTE_CLASS, retNoteClass);
		}
		int noteClassMask = retNoteClass.getShort(0);
		m_noteClass = NoteClass.toNoteClasses(noteClassMask);
	}
	return m_noteClass;
}
 
开发者ID:klehmann,项目名称:domino-jna,代码行数:24,代码来源:NotesNote.java

示例2: getOIDStruct

import com.sun.jna.Memory; //导入方法依赖的package包/类
/**
 * Internal method to get the populated {@link NotesOriginatorIdStruct} object
 * for this note
 * 
 * @return oid structure
 */
private NotesOriginatorIdStruct getOIDStruct() {
	checkHandle();
	
	Memory retOid = new Memory(NotesConstants.oidSize);
	retOid.clear();
	
	if (PlatformUtils.is64Bit()) {
		NotesNativeAPI64.get().NSFNoteGetInfo(m_hNote64, NotesConstants._NOTE_OID, retOid);
	}
	else {
		NotesNativeAPI32.get().NSFNoteGetInfo(m_hNote32, NotesConstants._NOTE_OID, retOid);
	}
	NotesOriginatorIdStruct oidStruct = NotesOriginatorIdStruct.newInstance(retOid);
	oidStruct.read();
	
	return oidStruct;
}
 
开发者ID:klehmann,项目名称:domino-jna,代码行数:24,代码来源:NotesNote.java

示例3: setUNID

import com.sun.jna.Memory; //导入方法依赖的package包/类
/**
 * Sets a new UNID in the {@link NotesOriginatorId} for this note
 * 
 * @param newUnid new universal id
 */
public void setUNID(String newUnid) {
	checkHandle();
	
	Memory retOid = new Memory(NotesConstants.oidSize);
	retOid.clear();
	
	if (PlatformUtils.is64Bit()) {
		NotesNativeAPI64.get().NSFNoteGetInfo(m_hNote64, NotesConstants._NOTE_OID, retOid);
	}
	else {
		NotesNativeAPI32.get().NSFNoteGetInfo(m_hNote32, NotesConstants._NOTE_OID, retOid);
	}
	NotesOriginatorIdStruct oidStruct = NotesOriginatorIdStruct.newInstance(retOid);
	oidStruct.read();
	oidStruct.setUNID(newUnid);
	if (PlatformUtils.is64Bit()) {
		NotesNativeAPI64.get().NSFNoteSetInfo(m_hNote64, NotesConstants._NOTE_OID, retOid);
	}
	else {
		NotesNativeAPI32.get().NSFNoteSetInfo(m_hNote32, NotesConstants._NOTE_OID, retOid);
	}
}
 
开发者ID:klehmann,项目名称:domino-jna,代码行数:28,代码来源:NotesNote.java

示例4: getLastModified

import com.sun.jna.Memory; //导入方法依赖的package包/类
/**
 * Returns the last modified date of the note
 * 
 * @return last modified date
 */
public Calendar getLastModified() {
	checkHandle();
	
	Memory retModified = new Memory(NotesConstants.timeDateSize);
	retModified.clear();
	
	if (PlatformUtils.is64Bit()) {
		NotesNativeAPI64.get().NSFNoteGetInfo(m_hNote64, NotesConstants._NOTE_MODIFIED, retModified);
	}
	else {
		NotesNativeAPI32.get().NSFNoteGetInfo(m_hNote32, NotesConstants._NOTE_MODIFIED, retModified);
	}
	NotesTimeDateStruct td = NotesTimeDateStruct.newInstance(retModified);
	td.read();
	Calendar cal = td.toCalendar();
	return cal;
}
 
开发者ID:klehmann,项目名称:domino-jna,代码行数:23,代码来源:NotesNote.java

示例5: getLastAccessed

import com.sun.jna.Memory; //导入方法依赖的package包/类
/**
 * Returns the last access date of the note
 * 
 * @return last access date
 */
public Calendar getLastAccessed() {
	checkHandle();
	
	Memory retModified = new Memory(NotesConstants.timeDateSize);
	retModified.clear();
	
	if (PlatformUtils.is64Bit()) {
		NotesNativeAPI64.get().NSFNoteGetInfo(m_hNote64, NotesConstants._NOTE_ACCESSED, retModified);
	}
	else {
		NotesNativeAPI32.get().NSFNoteGetInfo(m_hNote32, NotesConstants._NOTE_ACCESSED, retModified);
	}
	NotesTimeDateStruct td = NotesTimeDateStruct.newInstance(retModified);
	td.read();
	Calendar cal = td.toCalendar();
	return cal;
}
 
开发者ID:klehmann,项目名称:domino-jna,代码行数:23,代码来源:NotesNote.java

示例6: getAddedToFileTime

import com.sun.jna.Memory; //导入方法依赖的package包/类
/**
 * Returns the last access date of the note
 * 
 * @return last access date
 */
public Calendar getAddedToFileTime() {
	checkHandle();
	
	Memory retModified = new Memory(NotesConstants.timeDateSize);
	retModified.clear();
	
	if (PlatformUtils.is64Bit()) {
		NotesNativeAPI64.get().NSFNoteGetInfo(m_hNote64, NotesConstants._NOTE_ADDED_TO_FILE, retModified);
	}
	else {
		NotesNativeAPI32.get().NSFNoteGetInfo(m_hNote32, NotesConstants._NOTE_ADDED_TO_FILE, retModified);
	}
	NotesTimeDateStruct td = NotesTimeDateStruct.newInstance(retModified);
	td.read();
	Calendar cal = td.toCalendar();
	return cal;
}
 
开发者ID:klehmann,项目名称:domino-jna,代码行数:23,代码来源:NotesNote.java

示例7: getFlags

import com.sun.jna.Memory; //导入方法依赖的package包/类
/**
 * Reads the note flags (e.g. {@link NotesConstants#NOTE_FLAG_READONLY})
 * 
 * @return flags
 */
private short getFlags() {
	checkHandle();
	
	Memory retFlags = new Memory(2);
	retFlags.clear();
	
	if (PlatformUtils.is64Bit()) {
		NotesNativeAPI64.get().NSFNoteGetInfo(m_hNote64, NotesConstants._NOTE_FLAGS, retFlags);
	}
	else {
		NotesNativeAPI32.get().NSFNoteGetInfo(m_hNote32, NotesConstants._NOTE_FLAGS, retFlags);
	}
	short flags = retFlags.getShort(0);
	return flags;
}
 
开发者ID:klehmann,项目名称:domino-jna,代码行数:21,代码来源:NotesNote.java

示例8: getActiveNode

import com.sun.jna.Memory; //导入方法依赖的package包/类
public String getActiveNode()
{
	String activeNode = null;

	try
	{
		Pointer cluster = Clusapi.INSTANCE.OpenCluster(null);
		Pointer hEnum = Clusapi.INSTANCE.ClusterOpenEnum(cluster,
				Clusapi.CLUSTER_ENUM_GROUP);
		int dwIndex = 0;
		IntByReference lpdwType = new IntByReference();
		IntByReference lpcchName = new IntByReference();
		Memory lpszName = new Memory(256);
		lpszName.clear();
		lpcchName.setValue(256);
		int result = 0;
		do
		{
			result = Clusapi.INSTANCE.ClusterEnum(hEnum, dwIndex, lpdwType,
					lpszName, lpcchName);
			if (result == Clusapi.ERROR_SUCCESS)
			{
				String group = lpszName.getString(0, true);
				ClusterGroupInfo info = getGroupNodeInfo(cluster, group);
				if (info != null)
					activeNode = info.getLocation();
			}
			dwIndex++;
		}
		while (result == 0);
	}
	catch (Exception ex)
	{
		_log.log(Level.SEVERE, "Error getting cluster information", ex);
	}
	return activeNode;
}
 
开发者ID:yajsw,项目名称:yajsw,代码行数:38,代码来源:Cluster.java

示例9: getGroupNodeInfo

import com.sun.jna.Memory; //导入方法依赖的package包/类
private ClusterGroupInfo getGroupNodeInfo(Pointer cluster, String groupName)
{
	ClusterGroupInfo result = null;
	try
	{
		Pointer hGroup = Clusapi.INSTANCE.OpenClusterGroup(cluster,
				new WString(groupName));

		if (hGroup == null)
			throw new RuntimeException(
					"Clusapi call to OpenClusterGroup returned err code "
							+ MyKernel32.INSTANCE.GetLastError());

		IntByReference lpcchNodeName = new IntByReference();
		Memory lpszNodeName = new Memory(256);
		lpszNodeName.clear();
		lpcchNodeName.setValue(256);

		int state = Clusapi.INSTANCE.GetClusterGroupState(hGroup,
				lpszNodeName, lpcchNodeName);
		String location = lpszNodeName.getString(0, true);

		if (state == Clusapi.CLUSTER_GROUP_STATE_UNKNOWN)
			_log.severe("unknown group state for group " + groupName
					+ " err code " + MyKernel32.INSTANCE.GetLastError());

		result = new ClusterGroupInfo(groupName, state, location);

		MyKernel32.INSTANCE.CloseHandle(hGroup);
	}
	catch (Exception e)
	{
		_log.log(Level.SEVERE, "Error while getting GroupActiveNode", e);
	}
	return result;
}
 
开发者ID:yajsw,项目名称:yajsw,代码行数:37,代码来源:Cluster.java

示例10: getNoteId

import com.sun.jna.Memory; //导入方法依赖的package包/类
/**
 * Returns the note id of the note
 * 
 * @return note id
 */
public int getNoteId() {
	checkHandle();
	
	Memory retNoteId = new Memory(4);
	retNoteId.clear();
	
	if (PlatformUtils.is64Bit()) {
		NotesNativeAPI64.get().NSFNoteGetInfo(m_hNote64, NotesConstants._NOTE_ID, retNoteId);
	}
	else {
		NotesNativeAPI32.get().NSFNoteGetInfo(m_hNote32, NotesConstants._NOTE_ID, retNoteId);
	}
	return retNoteId.getInt(0);
}
 
开发者ID:klehmann,项目名称:domino-jna,代码行数:20,代码来源:NotesNote.java

示例11: getWorkingDirInternal

import com.sun.jna.Memory; //导入方法依赖的package包/类
protected String getWorkingDirInternal()
{
	String result = "";
	String cwd;
	boolean success = false;
	String procCwd = "/proc/" + getPid() + "/cwd";
	try
	{

		short BUFSIZE = 4096;
		Memory dir = new Memory(BUFSIZE);
		dir.clear();

		if (CLibrary.INSTANCE.getcwd(dir, BUFSIZE) != null)
		{
			cwd = dir.getString(0);
			dir.clear();

			if (CLibrary.INSTANCE.chdir(procCwd) == 0)
			{
				if (CLibrary.INSTANCE.getcwd(dir, BUFSIZE) != null)
				{
					result = new File(dir.getString(0)).getCanonicalPath();
					success = true;
				}
				// Restore starting directory ( if different )
				CLibrary.INSTANCE.chdir(cwd);
			}

		}

		if (!success)
			System.out
					.println("error reading process working dir -> please edit wrapper.working.dir in configuration file");

	}
	catch (IOException e)
	{
	}

	return result;

	// -KBG: short BUFSIZE = 512;
	// -KBG: Memory result = new Memory(BUFSIZE);
	// -KBG: result.clear();
	// -KBG: short size = CLibrary.INSTANCE.readlink(f, result, (short)
	// (BUFSIZE - 1));
	// -KBG: if (size <= 0)
	// -KBG: {
	// -KBG:
	// System.out.println("error reading process working dir -> please edit wrapper.working.dir in configuration file");
	// -KBG: return f;
	// -KBG: }
	// -KBG: result.setByte((long) size, (byte) 0);
	// -KBG: return result.getString(0);

	/*
	 * String result = null; File f = new File("/proc/" + getPid() +
	 * "/cwd"); try { result = f.getCanonicalPath(); } catch (IOException e)
	 * { e.printStackTrace(); } return result;
	 */

}
 
开发者ID:yajsw,项目名称:yajsw,代码行数:64,代码来源:SolarisProcess.java

示例12: getGroupInfo

import com.sun.jna.Memory; //导入方法依赖的package包/类
public Set<ClusterGroupInfo> getGroupInfo()
{
	Pointer hCluster = Clusapi.INSTANCE.OpenCluster(null);
	if (hCluster == null)
		throw new RuntimeException(
				"Clusapi call to OpenClusterGroup returned err code "
						+ MyKernel32.INSTANCE.GetLastError());

	Pointer hEnum = Clusapi.INSTANCE.ClusterOpenEnum(hCluster,
			Clusapi.CLUSTER_ENUM_GROUP);
	if (hEnum == null)
		throw new RuntimeException(
				"Clusapi call to ClusterOpenEnum returned err code "
						+ MyKernel32.INSTANCE.GetLastError());

	Set<ClusterGroupInfo> result = new LinkedHashSet<ClusterGroupInfo>();

	try
	{
		IntByReference lpdwType = new IntByReference();
		IntByReference lpcchName = new IntByReference(0);
		Memory lpszName = new Memory(256);

		int dwIndex = 0;

		int returnValue = 0;
		do
		{
			lpdwType.setValue(0);
			lpcchName.setValue(0);
			lpszName.clear();
			lpcchName.setValue(256);

			returnValue = Clusapi.INSTANCE.ClusterEnum(hEnum, dwIndex,
					lpdwType, lpszName, lpcchName);

			if (returnValue == Clusapi.ERROR_SUCCESS)
			{
				String group = lpszName.getString(0, true);
				ClusterGroupInfo info = getGroupNodeInfo(hCluster, group);
				if (info != null)
					result.add(info);
			}

			if ((returnValue != Clusapi.ERROR_NO_MORE_ITEMS)
					&& (returnValue != Clusapi.ERROR_SUCCESS))
				_log.log(Level.SEVERE, "strange returnValue from ClusApi"
						+ returnValue);

			dwIndex++;
		}
		while (returnValue == 0);
	}
	catch (Exception e)
	{
		_log.log(Level.SEVERE,
				"Error while getting Cluster group information", e);
	}
	finally
	{
		MyKernel32.INSTANCE.CloseHandle(hEnum);
		MyKernel32.INSTANCE.CloseHandle(hCluster);
	}
	return result;
}
 
开发者ID:yajsw,项目名称:yajsw,代码行数:66,代码来源:Cluster.java


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