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


Java ShortByReference.getValue方法代码示例

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


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

示例1: get

import com.sun.jna.ptr.ShortByReference; //导入方法依赖的package包/类
/**
 * Retrieves a message from a message queue, provided the queue is not in a QUIT state.
 * The message will be stored in the buffer specified in the Buffer argument.<br>
 * Note: The error code {@link INotesErrorConstants#ERR_MQ_QUITTING} indicates that the
 * message queue is in the QUIT state, denoting that applications that are reading
 * the message queue should terminate. For instance, a server addin's message queue
 * will be placed in the QUIT state when a "tell &lt;addin&gt; quit" command is input at the console.

 * @param buffer buffer used to read data
 * @param waitForMessage if the specified message queue is empty, wait for a message to appear in the queue. The timeout argument specifies the amount of time to wait for a message.
 * @param timeoutMillis if waitForMessage is set to <code>true</code>, the number of milliseconds to wait for a message before timing out. Specify 0 to wait forever. If the message queue goes into a QUIT state before the Timeout expires, MQGet will return immediately.
 * @param offset the offset in the buffer where to start writing the message
 * @param length the max length of the message in the buffer
 * @return Number of bytes written to the buffer
 */
public int get(Memory buffer, boolean waitForMessage, int timeoutMillis, int offset, int length) {
	checkHandle();

	if (length > NotesConstants.MQ_MAX_MSGSIZE) {
		throw new IllegalArgumentException("Max size for the buffer is "+NotesConstants.MQ_MAX_MSGSIZE+" bytes. You specified one with "+length+" bytes.");
	}

	ShortByReference retMsgLength = new ShortByReference();

	short result = NotesNativeAPI.get().MQGet(m_queue, buffer, (short) (length & 0xffff),
			waitForMessage ? NotesConstants.MQ_WAIT_FOR_MSG : 0,
					timeoutMillis, retMsgLength);
	NotesErrorUtils.checkResult(result);
	return retMsgLength.getValue();
}
 
开发者ID:klehmann,项目名称:domino-jna,代码行数:31,代码来源:MessageQueue.java

示例2: getCollation

import com.sun.jna.ptr.ShortByReference; //导入方法依赖的package包/类
/**
 * Returns the currently active collation
 * 
 * @return collation
 */
private short getCollation() {
	checkHandle();
	short result;
	ShortByReference retCollationNum = new ShortByReference();
	
	if (PlatformUtils.is64Bit()) {
		result = NotesNativeAPI64.get().NIFGetCollation(m_hCollection64, retCollationNum);
	}
	else {
		result = NotesNativeAPI32.get().NIFGetCollation(m_hCollection32, retCollationNum);
	}
	NotesErrorUtils.checkResult(result);
	return retCollationNum.getValue();
}
 
开发者ID:klehmann,项目名称:domino-jna,代码行数:20,代码来源:NotesCollection.java

示例3: decodeTextListValue

import com.sun.jna.ptr.ShortByReference; //导入方法依赖的package包/类
public static List<Object> decodeTextListValue(Pointer ptr, boolean convertStringsLazily) {
	//read a text list item value
	int listCountAsInt = ptr.getShort(0) & 0xffff;
	
	List<Object> listValues = new ArrayList<Object>(listCountAsInt);
	
	Memory retTextPointer = new Memory(Pointer.SIZE);
	ShortByReference retTextLength = new ShortByReference();
	
	for (short l=0; l<listCountAsInt; l++) {
		short result = NotesNativeAPI.get().ListGetText(ptr, false, l, retTextPointer, retTextLength);
		NotesErrorUtils.checkResult(result);
		
		//retTextPointer[0] points to the list entry text
		Pointer pointerToTextInMem = retTextPointer.getPointer(0);
		int retTextLengthAsInt = retTextLength.getValue() & 0xffff;
		
		if (retTextLengthAsInt==0) {
			listValues.add("");
		}
		else {
			if (convertStringsLazily) {
				byte[] stringDataArr = new byte[retTextLengthAsInt];
				pointerToTextInMem.read(0, stringDataArr, 0, retTextLengthAsInt);

				LMBCSString lmbcsString = new LMBCSString(stringDataArr);
				listValues.add(lmbcsString);
			}
			else {
				String currListEntry = NotesStringUtils.fromLMBCS(pointerToTextInMem, (short) retTextLengthAsInt);
				listValues.add(currListEntry);
			}
		}
	}
	
	return listValues;
}
 
开发者ID:klehmann,项目名称:domino-jna,代码行数:38,代码来源:ItemDecoder.java

示例4: getAccessInfoAndFlags

import com.sun.jna.ptr.ShortByReference; //导入方法依赖的package包/类
/**
 * This function gets the level of database access granted to the username that opened the database.
 * 
 * @return access level and flags
 */
public AccessInfoAndFlags getAccessInfoAndFlags() {
	checkHandle();
	
	ShortByReference retAccessLevel = new ShortByReference();
	ShortByReference retAccessFlag = new ShortByReference();
	
	if (PlatformUtils.is64Bit()) {
		NotesNativeAPI64.get().NSFDbAccessGet(m_hDB64, retAccessLevel, retAccessFlag);
	}
	else {
		NotesNativeAPI32.get().NSFDbAccessGet(m_hDB32, retAccessLevel, retAccessFlag);
	}
	
	int iAccessLevel = retAccessLevel.getValue();
	AclLevel retLevel = AclLevel.toLevel(iAccessLevel);
	
	int iAccessFlag = (int) (retAccessFlag.getValue() & 0xffff);
	EnumSet<AclFlag> retFlags = EnumSet.noneOf(AclFlag.class);
	for (AclFlag currFlag : AclFlag.values()) {
		if ((iAccessFlag & currFlag.getValue()) == currFlag.getValue()) {
			retFlags.add(currFlag);
		}
	}
	
	return new AccessInfoAndFlags(retLevel, retFlags);
}
 
开发者ID:klehmann,项目名称:domino-jna,代码行数:32,代码来源:NotesDatabase.java


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