com.mindoo.domino.jna.internal.ItemDecoder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of domino-jna Show documentation
Show all versions of domino-jna Show documentation
Java project to access the HCL Domino C API using Java Native Access (JNA)
package com.mindoo.domino.jna.internal;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.TimeZone;
import com.mindoo.domino.jna.NotesDateRange;
import com.mindoo.domino.jna.NotesTimeDate;
import com.mindoo.domino.jna.errors.NotesErrorUtils;
import com.mindoo.domino.jna.internal.structs.NotesNumberPairStruct;
import com.mindoo.domino.jna.internal.structs.NotesRangeStruct;
import com.mindoo.domino.jna.internal.structs.NotesTimeDatePairStruct;
import com.mindoo.domino.jna.internal.structs.NotesTimeDateStruct;
import com.mindoo.domino.jna.utils.LMBCSString;
import com.mindoo.domino.jna.utils.NotesDateTimeUtils;
import com.mindoo.domino.jna.utils.NotesStringUtils;
import com.sun.jna.Memory;
import com.sun.jna.Native;
import com.sun.jna.Pointer;
import com.sun.jna.ptr.ShortByReference;
public class ItemDecoder {
public static double decodeNumber(Pointer ptr, int valueLength) {
double numVal = ptr.getDouble(0);
return numVal;
}
public static Object decodeTextValue(Pointer ptr, int valueLength, boolean convertStringsLazily) {
if (valueLength<=0) {
return "";
}
if (convertStringsLazily) {
byte[] stringDataArr = new byte[valueLength];
ptr.read(0, stringDataArr, 0, valueLength);
LMBCSString lmbcsString = new LMBCSString(stringDataArr);
return lmbcsString;
}
else {
String txtVal = NotesStringUtils.fromLMBCS(ptr, valueLength);
return txtVal;
}
}
public static List