com.sun.jna.ptr.ShortByReference Java Examples

The following examples show how to use com.sun.jna.ptr.ShortByReference. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MessageQueue.java    From domino-jna with Apache License 2.0 6 votes vote down vote up
/**
 * 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();
}
 
Example #2
Source File: INotesNativeAPI64.java    From domino-jna with Apache License 2.0 6 votes vote down vote up
public short CalReadRange(
long hDB,
NotesTimeDateStruct.ByValue tdStart,
NotesTimeDateStruct.ByValue  tdEnd,
int dwViewSkipCount,
int dwMaxReturnCount,
int dwReturnMask,
int dwReturnMaskExt,
Pointer pFilterInfo,
LongByReference hRetCalData,
ShortByReference retCalBufferLength,
LongByReference hRetUIDData,
IntByReference retNumEntriesProcessed,
ShortByReference retSignalFlags,
int dwFlags,
Pointer pCtx);
 
Example #3
Source File: LMBCSStringList.java    From domino-jna with Apache License 2.0 6 votes vote down vote up
/**
 * Removes all entries from the list
 */
public void clear() {
	if (m_values.isEmpty()) {
		return;
	}
	
	checkHandle();
	
	ShortByReference retListSize = new ShortByReference();
	
	short result;
	if (PlatformUtils.is64Bit()) {
		result = NotesNativeAPI64.get().ListRemoveAllEntries(m_handle64, m_prefixDataType ? 1 : 0, retListSize);
	}
	else {
		result = NotesNativeAPI32.get().ListRemoveAllEntries(m_handle32, m_prefixDataType ? 1 : 0, retListSize);
	}
	NotesErrorUtils.checkResult(result);
	
	m_listSizeBytes = (int) (retListSize.getValue() & 0xffff);
	m_values.clear();
}
 
Example #4
Source File: NotesNativeAPI32.java    From domino-jna with Apache License 2.0 5 votes vote down vote up
public native short NSFDbGetObjectSize(
int hDB,
int ObjectID,
short ObjectType,
IntByReference retSize,
ShortByReference retClass,
ShortByReference retPrivileges);
 
Example #5
Source File: INotesNativeAPI64.java    From domino-jna with Apache License 2.0 5 votes vote down vote up
public short NSFDbGetObjectSize(
long hDB,
int ObjectID,
short ObjectType,
IntByReference retSize,
ShortByReference retClass,
ShortByReference retPrivileges);
 
Example #6
Source File: INotesNativeAPI64.java    From domino-jna with Apache License 2.0 5 votes vote down vote up
public short NIFFindByKeyExtended2 (long hCollection, Memory keyBuffer,
int findFlags,
int returnFlags,
NotesCollectionPositionStruct retIndexPos,
IntByReference retNumMatches,
ShortByReference retSignalFlags,
LongByReference rethBuffer,
IntByReference retSequence);
 
Example #7
Source File: INotesNativeAPI64.java    From domino-jna with Apache License 2.0 5 votes vote down vote up
@UndocumentedAPI
public short NIFReadEntriesExt(long hCollection,
		NotesCollectionPositionStruct CollectionPos,
           short SkipNavigator, int SkipCount,
           short ReturnNavigator, int ReturnCount, int ReturnMask,
           NotesTimeDateStruct DiffTime, long DiffIDTable, int ColumnNumber, int Flags,
           LongByReference rethBuffer, ShortByReference retBufferLength,
           IntByReference retNumEntriesSkipped, IntByReference retNumEntriesReturned,
           ShortByReference retSignalFlags, NotesTimeDateStruct retDiffTime,
           NotesTimeDateStruct retModifiedTime, IntByReference retSequence);
 
Example #8
Source File: NotesNamingUtils.java    From domino-jna with Apache License 2.0 5 votes vote down vote up
/**
 * This function converts a distinguished name in canonical format to abbreviated format.
 * A fully distinguished name is in canonical format - it contains all possible naming components.
 * The abbreviated format of a distinguished name removes the labels from the naming components.
 * 
 * @param name name to convert
 * @param templateName name to be used when the input name is in common name format
 * @return abbreviated name
 */
public static String toAbbreviatedName(String name, String templateName) {
	if (name==null)
		return null;
	if (name.length()==0)
		return name;
	
	String cacheKey = name + ((templateName!=null && templateName.length()>0) ? ("|" + templateName) : "");
	String abbrName = m_nameAbbrCache.get(cacheKey);
	if (abbrName!=null) {
		return abbrName;
	}
	
	Memory templateNameMem = templateName==null || templateName.length()==0 ? null : NotesStringUtils.toLMBCS(templateName, true); //used when abbrName is only a common name
	Memory inNameMem = NotesStringUtils.toLMBCS(name, true);
	DisposableMemory outNameMem = new DisposableMemory(NotesConstants.MAXUSERNAME);
	ShortByReference outLength = new ShortByReference();
	
	short result = NotesNativeAPI.get().DNAbbreviate(0, templateNameMem, inNameMem, outNameMem, NotesConstants.MAXUSERNAME, outLength);
	NotesErrorUtils.checkResult(result);
	
	String sOutName = NotesStringUtils.fromLMBCS(outNameMem, (int) (outLength.getValue() & 0xffff));
	outNameMem.dispose();
	
	m_nameAbbrCache.put(cacheKey, sOutName);
	
	return sOutName;
}
 
Example #9
Source File: NotesNativeAPI64.java    From domino-jna with Apache License 2.0 5 votes vote down vote up
public native short ECLUserTrustSigner ( long hCESCtx, 
short ECLType,
short bSessionOnly,
short wCapabilities,
short wCapabilities2,
ShortByReference retwCurrentCapabilities,
ShortByReference retwCurrentCapabilities2);
 
Example #10
Source File: INotesNativeAPI64.java    From domino-jna with Apache License 2.0 5 votes vote down vote up
public short NSFFormulaCompile(
Memory FormulaName,
short FormulaNameLength,
Memory FormulaText,
short  FormulaTextLength,
LongByReference rethFormula,
ShortByReference retFormulaLength,
ShortByReference retCompileError,
ShortByReference retCompileErrorLine,
ShortByReference retCompileErrorColumn,
ShortByReference retCompileErrorOffset,
ShortByReference retCompileErrorLength);
 
Example #11
Source File: INotesNativeAPI64.java    From domino-jna with Apache License 2.0 5 votes vote down vote up
public short CalGetNewInvitations(
long hDB,
NotesTimeDateStruct ptdStart,
Memory pszUID,
NotesTimeDateStruct ptdSince,
NotesTimeDateStruct ptdretUntil,
ShortByReference pwNumInvites,
LongByReference phRetNOTEIDs,
LongByReference phRetUNIDs,
Pointer pReserved,
int dwFlags,
Pointer pCtx);
 
Example #12
Source File: NotesNativeAPI32.java    From domino-jna with Apache License 2.0 5 votes vote down vote up
public native short ListAllocate(
short ListEntries,
short TextSize,
int fPrefixDataType,
IntByReference rethList,
Memory retpList,
ShortByReference retListSize);
 
Example #13
Source File: NotesNativeAPI32.java    From domino-jna with Apache License 2.0 5 votes vote down vote up
public native short ListAddEntry(
int hList,
int fPrefixDataType,
ShortByReference pListSize,
short EntryNumber,
Memory Text,
short TextSize);
 
Example #14
Source File: INotesNativeAPI32.java    From domino-jna with Apache License 2.0 5 votes vote down vote up
public short NSFItemInfoPrev(
int  note_handle,
NotesBlockIdStruct.ByValue  CurrItem,
Memory item_name,
short  name_len,
NotesBlockIdStruct item_blockid_ptr,
ShortByReference value_type_ptr,
NotesBlockIdStruct value_blockid_ptr,
IntByReference value_len_ptr);
 
Example #15
Source File: NotesNativeAPI32.java    From domino-jna with Apache License 2.0 5 votes vote down vote up
public native short NSFItemInfo(
int  note_handle,
Memory item_name,
short name_len,
NotesBlockIdStruct retbhItem,
ShortByReference retDataType,
NotesBlockIdStruct retbhValue,
IntByReference retValueLength);
 
Example #16
Source File: NotesNativeAPI32.java    From domino-jna with Apache License 2.0 5 votes vote down vote up
public native short NSFItemInfoPrev(
int  note_handle,
NotesBlockIdStruct.ByValue  CurrItem,
Memory item_name,
short  name_len,
NotesBlockIdStruct item_blockid_ptr,
ShortByReference value_type_ptr,
NotesBlockIdStruct value_blockid_ptr,
IntByReference value_len_ptr);
 
Example #17
Source File: NotesNativeAPI32.java    From domino-jna with Apache License 2.0 5 votes vote down vote up
public native short NSFDbGetNoteInfoExt(
int  hDB,
int  NoteID,
NotesOriginatorIdStruct retNoteOID,
NotesTimeDateStruct retModified,
ShortByReference retNoteClass,
NotesTimeDateStruct retAddedToFile,
ShortByReference retResponseCount,
IntByReference retParentNoteID);
 
Example #18
Source File: NotesCollection.java    From domino-jna with Apache License 2.0 5 votes vote down vote up
/**
 * 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();
}
 
Example #19
Source File: NotesNativeAPI32.java    From domino-jna with Apache License 2.0 5 votes vote down vote up
public native short NIFReadEntriesExt(int hCollection,
NotesCollectionPositionStruct CollectionPos,
short SkipNavigator, int SkipCount,
short ReturnNavigator, int ReturnCount, int ReturnMask,
NotesTimeDateStruct DiffTime, int DiffIDTable, int ColumnNumber, int Flags,
IntByReference rethBuffer, ShortByReference retBufferLength,
IntByReference retNumEntriesSkipped, IntByReference retNumEntriesReturned,
ShortByReference retSignalFlags, NotesTimeDateStruct retDiffTime,
NotesTimeDateStruct retModifiedTime, IntByReference retSequence);
 
Example #20
Source File: NotesNativeAPI32.java    From domino-jna with Apache License 2.0 5 votes vote down vote up
public native short NIFFindByKeyExtended3 (int hCollection,
Memory keyBuffer, int findFlags,
int returnFlags,
NotesCollectionPositionStruct retIndexPos,
IntByReference retNumMatches, ShortByReference retSignalFlags,
IntByReference rethBuffer, IntByReference retSequence,
NotesCallbacks.NIFFindByKeyProc NIFFindByKeyCallback, NIFFindByKeyContextStruct Ctx);
 
Example #21
Source File: JnaBlob.java    From jaybird with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public byte[] getSegment(int sizeRequested) throws SQLException {
    try {
        if (sizeRequested <= 0) {
            throw new FbExceptionBuilder().exception(jb_blobGetSegmentNegative)
                    .messageParameter(sizeRequested)
                    .toSQLException();
        }
        // TODO Honour request for larger sizes by looping?
        sizeRequested = Math.min(sizeRequested, getMaximumSegmentSize());
        final ByteBuffer responseBuffer;
        final ShortByReference actualLength = new ShortByReference();
        synchronized (getSynchronizationObject()) {
            checkDatabaseAttached();
            checkTransactionActive();
            checkBlobOpen();
            responseBuffer = getByteBuffer(sizeRequested);

            clientLibrary.isc_get_segment(statusVector, getJnaHandle(), actualLength, (short) sizeRequested,
                    responseBuffer);
            final int status = statusVector[1].intValue();
            // status 0 means: more to come, isc_segment means: buffer was too small, rest will be returned on next call
            if (!(status == 0 || status == ISCConstants.isc_segment)) {
                if (status == ISCConstants.isc_segstr_eof) {
                    setEof();
                } else {
                    processStatusVector();
                }
            }
        }
        final int actualLengthInt = ((int) actualLength.getValue()) & 0xFFFF;
        final byte[] segment = new byte[actualLengthInt];
        responseBuffer.get(segment);
        return segment;
    } catch (SQLException e) {
        exceptionListenerDispatcher.errorOccurred(e);
        throw e;
    }
}
 
Example #22
Source File: INotesNativeAPI32.java    From domino-jna with Apache License 2.0 5 votes vote down vote up
public short NSFDbGetNoteInfoExt(
int  hDB,
int  NoteID,
NotesOriginatorIdStruct retNoteOID,
NotesTimeDateStruct retModified,
ShortByReference retNoteClass,
NotesTimeDateStruct retAddedToFile,
ShortByReference retResponseCount,
IntByReference retParentNoteID);
 
Example #23
Source File: NotesNativeAPI32.java    From domino-jna with Apache License 2.0 5 votes vote down vote up
public native short ECLUserTrustSigner ( int hCESCtx, 
short ECLType,
short bSessionOnly,
short wCapabilities,
short wCapabilities2,
ShortByReference retwCurrentCapabilities,
ShortByReference retwCurrentCapabilities2);
 
Example #24
Source File: NotesNativeAPI32.java    From domino-jna with Apache License 2.0 5 votes vote down vote up
public native short MIMEHeaderNameToItemName(
short wMessageType,
Memory pszHeaderName,
Memory pszHeaderBody,
Memory retszItemName,
short wItemNameSize,
ShortByReference retwHeaderType,
ShortByReference retwItemFlags,
ShortByReference retwDataType);
 
Example #25
Source File: INotesNativeAPI32.java    From domino-jna with Apache License 2.0 5 votes vote down vote up
public short NSFComputeEvaluate(
int  hCompute,
int hNote,
IntByReference rethResult,
ShortByReference retResultLength,
IntByReference retNoteMatchesFormula,
IntByReference retNoteShouldBeDeleted,
IntByReference retNoteModified);
 
Example #26
Source File: RenderModel_t.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * @param rVertexData const struct vr::RenderModel_Vertex_t *<br>
 * C type : RenderModel_Vertex_t*<br>
 * @param rIndexData const uint16_t *<br>
 * C type : uint16_t*<br>
 * @param diffuseTextureId C type : TextureID_t
 */
public RenderModel_t(com.jme3.system.jopenvr.RenderModel_Vertex_t.ByReference rVertexData, int unVertexCount, ShortByReference rIndexData, int unTriangleCount, int diffuseTextureId) {
	super();
	this.rVertexData = rVertexData;
	this.unVertexCount = unVertexCount;
	this.rIndexData = rIndexData;
	this.unTriangleCount = unTriangleCount;
	this.diffuseTextureId = diffuseTextureId;
}
 
Example #27
Source File: NotesNativeAPI64.java    From domino-jna with Apache License 2.0 5 votes vote down vote up
public native short ListAddEntry(
long hList,
int fPrefixDataType,
ShortByReference pListSize,
short EntryNumber,
Memory Text,
short TextSize);
 
Example #28
Source File: INotesNativeAPI32.java    From domino-jna with Apache License 2.0 5 votes vote down vote up
public short ListAddEntry(
int hList,
int fPrefixDataType,
ShortByReference pListSize,
short EntryNumber,
Memory Text,
short TextSize);
 
Example #29
Source File: INotesNativeAPI32.java    From domino-jna with Apache License 2.0 5 votes vote down vote up
@UndocumentedAPI
public short NIFFindByKeyExtended3 (int hCollection,
		Memory keyBuffer, int findFlags,
		int returnFlags,
		NotesCollectionPositionStruct retIndexPos,
		IntByReference retNumMatches, ShortByReference retSignalFlags,
		IntByReference rethBuffer, IntByReference retSequence,
		NotesCallbacks.NIFFindByKeyProc NIFFindByKeyCallback, NIFFindByKeyContextStruct Ctx);
 
Example #30
Source File: ItemDecoder.java    From domino-jna with Apache License 2.0 5 votes vote down vote up
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(Native.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;
}