本文整理汇总了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 <addin> 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();
}
示例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();
}
示例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;
}
示例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);
}