com.sun.jna.Structure Java Examples

The following examples show how to use com.sun.jna.Structure. 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: NotesOriginatorId.java    From domino-jna with Apache License 2.0 6 votes vote down vote up
@Override
public <T> T getAdapter(Class<T> clazz) {
	if (clazz == NotesOriginatorIdStruct.class || clazz == Structure.class) {
		if (m_struct==null) {
			m_struct = NotesOriginatorIdStruct.newInstance();
			m_struct.Sequence = this.sequence;
			m_struct.SequenceTime = this.sequenceTime==null ? null : this.sequenceTime.getAdapter(NotesTimeDateStruct.class);
			
			if (this.unid!=null) {
				m_struct.setUNID(this.unid);
			}
			m_struct.write();
		}
		return (T) m_struct;
	}
	return null;
}
 
Example #2
Source File: NotesDbReplicaInfo.java    From domino-jna with Apache License 2.0 5 votes vote down vote up
@Override
public <T> T getAdapter(Class<T> clazz) {
	if (clazz == NotesDbReplicaInfoStruct.class || clazz == Structure.class) {
		return (T) m_struct;
	}
	return null;
}
 
Example #3
Source File: NotesCollateDescriptorStruct.java    From domino-jna with Apache License 2.0 5 votes vote down vote up
/**
 * @param Flags flags
 * @param signature Must be COLLATE_DESCRIPTOR_SIGNATURE<br>
 * @param keytype Type of key (COLLATE_TYPE_xxx)<br>
 * @param NameOffset Offset to the name string<br>
 * @param NameLength Length of the name string
 */
public NotesCollateDescriptorStruct(byte Flags, byte signature, byte keytype, short NameOffset, short NameLength) {
	super();
	this.Flags = Flags;
	this.signature = signature;
	this.keytype = keytype;
	this.NameOffset = NameOffset;
	this.NameLength = NameLength;
	setAlignType(Structure.ALIGN_NONE);
}
 
Example #4
Source File: NotesCollationStruct.java    From domino-jna with Apache License 2.0 5 votes vote down vote up
/**
 * @param BufferSize Size of entire buffer in bytes<br>
 * @param Items Number of items following<br>
 * @param Flags See COLLATION_FLAG_xxx<br>
 * @param signature Must be COLLATION_SIGNATURE
 */
public NotesCollationStruct(short BufferSize, short Items, byte Flags, byte signature) {
	super();
	this.BufferSize = BufferSize;
	this.Items = Items;
	this.Flags = Flags;
	this.signature = signature;
	setAlignType(Structure.ALIGN_NONE);
}
 
Example #5
Source File: NIFFindByKeyContextStruct.java    From domino-jna with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new context
 * 
 * @param EntriesThisChunk entries in this chunk
 * @param wSizeOfChunk size of chunk
 * @param SummaryBuffer summary buffer pointer
 * @param hUserData handle user data
 * @param UserDataLen length of user data
 * @param TotalDataInBuffer total size of buffer
 */
public NIFFindByKeyContextStruct(short EntriesThisChunk, short wSizeOfChunk, Pointer SummaryBuffer, int hUserData, int UserDataLen, int TotalDataInBuffer) {
	super();
	this.EntriesThisChunk = EntriesThisChunk;
	this.wSizeOfChunk = wSizeOfChunk;
	this.SummaryBuffer = SummaryBuffer;
	this.hUserData = hUserData;
	this.UserDataLen = UserDataLen;
	this.TotalDataInBuffer = TotalDataInBuffer;
	setAlignType(Structure.ALIGN_DEFAULT);
}
 
Example #6
Source File: WinNotesNamesListHeader64Struct.java    From domino-jna with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new instance
 * 
 * @param numNames number of names in the list
 * @param id info from LICENSEID, should be empty
 * @param product info from LICENSEID, should be empty
 * @param check info from LICENSEID, should be empty
 * @param authenticated  Flag to mark the user as already authenticated, e.g. via web server
 * @deprecated only public to be used by JNA; use static newInstance method instead to run in AccessController.doPrivileged block
 */
public WinNotesNamesListHeader64Struct(short numNames, byte id[], byte product, byte check[], short authenticated) {
	super();
	this.NumNames = numNames;
	if ((id.length != this.ID.length)) 
		throw new IllegalArgumentException("Wrong array size !");
	this.ID = id;
	this.Product = product;
	if ((check.length != this.Check.length)) 
		throw new IllegalArgumentException("Wrong array size !");
	this.Check = check;
	this.Authenticated = authenticated;
	setAlignType(Structure.ALIGN_DEFAULT);
}
 
Example #7
Source File: NotesTFMTStruct.java    From domino-jna with Apache License 2.0 5 votes vote down vote up
/**
 * @param Date Date Display Format<br>
 * @param Time Time Display Format<br>
 * @param Zone Time Zone Display Format<br>
 * @param Structure Overall Date/Time Structure
 */
public NotesTFMTStruct(byte Date, byte Time, byte Zone, byte Structure) {
	super();
	this.Date = Date;
	this.Time = Time;
	this.Zone = Zone;
	this.Structure = Structure;
}
 
Example #8
Source File: NotesTFMTStruct.java    From domino-jna with Apache License 2.0 5 votes vote down vote up
public static NotesTFMTStruct newInstance(final byte Date, final byte Time, final byte Zone, final byte Structure) {
	return AccessController.doPrivileged(new PrivilegedAction<NotesTFMTStruct>() {

		@Override
		public NotesTFMTStruct run() {
			return new NotesTFMTStruct(Date, Time, Zone, Structure);
		}
	});
}
 
Example #9
Source File: NotesViewColumnFormat5Struct.java    From domino-jna with Apache License 2.0 5 votes vote down vote up
/**
 * @param Signature VIEW_COLUMN_FORMAT_SIGNATURE5
 * @param dwLength sizeof this structure + any extra data.
 * @param dwFlags flags 
 * @param wDistNameColLen Length of programatic name of column that contains distiguished name.
 * @param wSharedColumnAliasLen If shared column, length of the alias of the shared column
 * @param dwReserved Reserved for future use.
 * C type : DWORD[4]
 */
public NotesViewColumnFormat5Struct(short Signature, short dwLength, int dwFlags, short wDistNameColLen, short wSharedColumnAliasLen, int dwReserved[]) {
	super();
	this.Signature = Signature;
	this.dwLength = dwLength;
	this.dwFlags = dwFlags;
	this.wDistNameColLen = wDistNameColLen;
	this.wSharedColumnAliasLen = wSharedColumnAliasLen;
	if ((dwReserved.length != this.dwReserved.length)) 
		throw new IllegalArgumentException("Wrong array size !");
	this.dwReserved = dwReserved;
	setAlignType(Structure.ALIGN_NONE);
}
 
Example #10
Source File: NotesObjectDescriptorStruct.java    From domino-jna with Apache License 2.0 5 votes vote down vote up
/**
 * @param ObjectType Type of object (OBJECT_xxx)<br>
 * @param RRV Object ID of the object in THIS FILE
 * @deprecated only public to be used by JNA; use static newInstance method instead to run in AccessController.doPrivileged block
 */
public NotesObjectDescriptorStruct(short ObjectType, int RRV) {
	super();
	setAlignType(Structure.ALIGN_NONE);
	this.ObjectType = ObjectType;
	this.RRV = RRV;
}
 
Example #11
Source File: NotesUniversalNoteId.java    From domino-jna with Apache License 2.0 5 votes vote down vote up
@Override
public <T> T getAdapter(Class<T> clazz) {
	if (clazz == NotesUniversalNoteIdStruct.class || clazz == Structure.class) {
		return (T) m_struct;
	}
	else if (clazz == String.class) {
		return (T) toString();
	}
	
	return null;
}
 
Example #12
Source File: NotesCollectionPosition.java    From domino-jna with Apache License 2.0 5 votes vote down vote up
@Override
public <T> T getAdapter(Class<T> clazz) {
	if (clazz == NotesCollectionPositionStruct.class || clazz == Structure.class) {
		if (this.struct==null) {
			this.struct = NotesCollectionPositionStruct.newInstance();
			this.struct.Level = (short) (this.level & 0xffff);
			this.struct.MinLevel = (byte) (this.minLevel & 0xff);
			this.struct.MaxLevel = (byte) (this.maxLevel & 0xff);
			this.struct.Tumbler = this.tumbler.clone();
			this.struct.write();
		}
		return (T) this.struct;
	}
	return null;
}
 
Example #13
Source File: LeptUtilsTest.java    From lept4j with Apache License 2.0 5 votes vote down vote up
/**
 * Test of dispose method, of class LeptUtils.
 */
@Test
public void testDispose() {
    System.out.println("dispose");
    Structure resource = null;
    LeptUtils.dispose(resource);
}
 
Example #14
Source File: NotesViewTableFormatStruct.java    From domino-jna with Apache License 2.0 5 votes vote down vote up
/**
 * @param Header C type : VIEW_FORMAT_HEADER<br>
 * @param Columns Number of columns<br>
 * @param ItemSequenceNumber Seq. number for unique item names<br>
 * @param Flags (see VIEW_TABLE_xxx)<br>
 * @param Flags2 Flags
 */
public NotesViewTableFormatStruct(NotesViewFormatHeaderStruct Header, short Columns, short ItemSequenceNumber, short Flags, short Flags2) {
	super();
	this.Header = Header;
	this.Columns = Columns;
	this.ItemSequenceNumber = ItemSequenceNumber;
	this.Flags = Flags;
	this.Flags2 = Flags2;
	setAlignType(Structure.ALIGN_NONE);
}
 
Example #15
Source File: NotesFontIDFieldsStruct.java    From domino-jna with Apache License 2.0 5 votes vote down vote up
/**
 * @param Face Font face (FONT_FACE_xxx)<br>
 * @param Attrib Attributes (ISBOLD,etc)<br>
 * @param Color Color index (NOTES_COLOR_xxx)<br>
 * @param PointSize Size of font in points
 */
public NotesFontIDFieldsStruct(byte Face, byte Attrib, byte Color, byte PointSize) {
	super();
	this.Face = Face;
	this.Attrib = Attrib;
	this.Color = Color;
	this.PointSize = PointSize;
	setAlignType(Structure.ALIGN_NONE);
}
 
Example #16
Source File: LibraryUtil.java    From canon-sdk-java with MIT License 5 votes vote down vote up
private List<String> getConstantInterfaceNames() {
    final Class<?>[] classes = EdsdkLibrary.class.getClasses();

    if (classes.length == 0)
        throw new IllegalStateException("");

    return Arrays.stream(classes)
        .filter(aClass -> !Structure.class.isAssignableFrom(aClass))
        .filter(aClass -> !PointerType.class.isAssignableFrom(aClass))
        .filter(aClass -> !Structure.ByReference.class.isAssignableFrom(aClass))
        .filter(aClass -> !StdCallLibrary.StdCallCallback.class.isAssignableFrom(aClass))
        .map(Class::getSimpleName)
        .collect(Collectors.toList());
}
 
Example #17
Source File: NativeLibrary.java    From jnanomsg with Apache License 2.0 4 votes vote down vote up
public NNPollEvent(int fd, short events, short revents) {
  super(Structure.ALIGN_NONE);
  this.fd = fd;
  this.events = events;
  this.revents = revents;
}
 
Example #18
Source File: LeptUtils.java    From lept4j with Apache License 2.0 4 votes vote down vote up
/**
 * Disposes of Leptonica native resource.
 *
 * @param resource A Leptonica object, such as <code>Pix</code>,
 * <code>Pixa</code>, <code>Box</code>, <code>Boxa</code>,
 * <code>PixColormap</code>, etc.
 */
public static void dispose(Structure resource) {
    if (resource == null) {
        return;
    }
    PointerByReference pRef = new PointerByReference();
    pRef.setValue(resource.getPointer());

    if (resource instanceof Pix) {
        Leptonica1.pixDestroy(pRef);
    } else if (resource instanceof Pixa) {
        Leptonica1.pixaDestroy(pRef);
    } else if (resource instanceof Box) {
        Leptonica1.boxDestroy(pRef);
    } else if (resource instanceof Boxa) {
        Leptonica1.boxaDestroy(pRef);
    } else if (resource instanceof L_Bmf) {
        Leptonica1.bmfDestroy(pRef);
    } else if (resource instanceof L_ByteBuffer) {
        Leptonica1.bbufferDestroy(pRef);
    } else if (resource instanceof Boxaa) {
        Leptonica1.boxaaDestroy(pRef);
    } else if (resource instanceof L_Bytea) {
        Leptonica1.l_byteaDestroy(pRef);
    } else if (resource instanceof CCBorda) {
        Leptonica1.ccbaDestroy(pRef);
    } else if (resource instanceof CCBord) {
        Leptonica1.ccbDestroy(pRef);
    } else if (resource instanceof PixColormap) {
        Leptonica1.pixcmapDestroy(pRef);
    } else if (resource instanceof L_Dewarp) {
        Leptonica1.dewarpDestroy(pRef);
    } else if (resource instanceof L_Dewarpa) {
        Leptonica1.dewarpaDestroy(pRef);
    } else if (resource instanceof L_Dna) {
        Leptonica1.l_dnaDestroy(pRef);
    } else if (resource instanceof L_Dnaa) {
        Leptonica1.l_dnaaDestroy(pRef);
    } else if (resource instanceof L_DnaHash) {
        Leptonica1.l_dnaHashDestroy(pRef);
    } else if (resource instanceof FPix) {
        Leptonica1.fpixDestroy(pRef);
    } else if (resource instanceof FPixa) {
        Leptonica1.fpixaDestroy(pRef);
    } else if (resource instanceof DPix) {
        Leptonica1.dpixDestroy(pRef);
    } else if (resource instanceof GPlot) {
        Leptonica1.gplotDestroy(pRef);
    } else if (resource instanceof JbClasser) {
        Leptonica1.jbClasserDestroy(pRef);
    } else if (resource instanceof JbData) {
        Leptonica1.jbDataDestroy(pRef);
    } else if (resource instanceof L_Kernel) {
        Leptonica1.kernelDestroy(pRef);
    } else if (resource instanceof Numa) {
        Leptonica1.numaDestroy(pRef);
    } else if (resource instanceof Numaa) {
        Leptonica1.numaaDestroy(pRef);
    } else if (resource instanceof Pixaa) {
        Leptonica1.pixaaDestroy(pRef);
    } else if (resource instanceof Pixacc) {
        Leptonica1.pixaccDestroy(pRef);
    } else if (resource instanceof PixComp) {
        Leptonica1.pixcompDestroy(pRef);
    } else if (resource instanceof PixaComp) {
        Leptonica1.pixacompDestroy(pRef);
    } else if (resource instanceof PixTiling) {
        Leptonica1.pixTilingDestroy(pRef);
    } else if (resource instanceof Pta) {
        Leptonica1.ptaDestroy(pRef);
    } else if (resource instanceof Ptaa) {
        Leptonica1.ptaaDestroy(pRef);
    } else if (resource instanceof L_Recog) {
        Leptonica1.recogDestroy(pRef);
    } else if (resource instanceof Sarray) {
        Leptonica1.sarrayDestroy(pRef);
    } else if (resource instanceof Sel) {
        Leptonica1.selDestroy(pRef);
    } else if (resource instanceof Sela) {
        Leptonica1.selaDestroy(pRef);
    } else if (resource instanceof L_Sudoku) {
        Leptonica1.sudokuDestroy(pRef);
    } else if (resource instanceof L_WShed) {
        Leptonica1.wshedDestroy(pRef);
    } else if (resource instanceof DoubleLinkedList) {
        Leptonica1.listDestroy(pRef);
    } else if (resource instanceof L_Rbtree) {
        Leptonica1.l_rbtreeDestroy(pRef);
    } else {
        throw new RuntimeException("Not supported.");
    }
}
 
Example #19
Source File: NativeLibrary.java    From jnanomsg with Apache License 2.0 4 votes vote down vote up
public NNPollEvent(Pointer p) {
  super(p, Structure.ALIGN_NONE);
  setAlignType(Structure.ALIGN_NONE);
  read();
}
 
Example #20
Source File: NotesCollateDescriptorStruct.java    From domino-jna with Apache License 2.0 4 votes vote down vote up
public NotesCollateDescriptorStruct(Pointer peer) {
	super(peer);
	setAlignType(Structure.ALIGN_NONE);
}
 
Example #21
Source File: WinNotesNamesListHeader64Struct.java    From domino-jna with Apache License 2.0 4 votes vote down vote up
/**
 * @deprecated only public to be used by JNA; use static newInstance method instead to run in AccessController.doPrivileged block
 */
public WinNotesNamesListHeader64Struct() {
	super();
	setAlignType(Structure.ALIGN_DEFAULT);
}
 
Example #22
Source File: NativeLibrary.java    From jnanomsg with Apache License 2.0 4 votes vote down vote up
public NNPollEvent() {
  super(Structure.ALIGN_NONE);
}
 
Example #23
Source File: NotesFileObjectStruct.java    From domino-jna with Apache License 2.0 4 votes vote down vote up
/**
 * @deprecated only public to be used by JNA; use static newInstance method instead to run in AccessController.doPrivileged block
 */
public NotesFileObjectStruct() {
	super();
	setAlignType(Structure.ALIGN_NONE);
}
 
Example #24
Source File: IntlFormatStruct.java    From domino-jna with Apache License 2.0 4 votes vote down vote up
public IntlFormatStruct() {
	super();
	setAlignType(Structure.ALIGN_NONE);
}
 
Example #25
Source File: IntlFormatStruct.java    From domino-jna with Apache License 2.0 4 votes vote down vote up
public IntlFormatStruct(Pointer peer) {
	super(peer);
	setAlignType(Structure.ALIGN_NONE);
}
 
Example #26
Source File: SetupApi.java    From Flashtool with GNU General Public License v3.0 4 votes vote down vote up
public SP_DEVICE_INTERFACE_DETAIL_DATA(int size) {
	cbSize = size();
	devicePath = new char[size];
	setAlignType(Structure.ALIGN_NONE);
}
 
Example #27
Source File: SetupApi.java    From Flashtool with GNU General Public License v3.0 4 votes vote down vote up
public SP_DEVICE_INTERFACE_DETAIL_DATA() {
    cbSize = size();
    setAlignType(Structure.ALIGN_NONE);
}
 
Example #28
Source File: NotesObjectDescriptorStruct.java    From domino-jna with Apache License 2.0 4 votes vote down vote up
/**
 * @deprecated only public to be used by JNA; use static newInstance method instead to run in AccessController.doPrivileged block
 */
public NotesObjectDescriptorStruct() {
	super();
	setAlignType(Structure.ALIGN_NONE);
}
 
Example #29
Source File: Stat.java    From unidbg with Apache License 2.0 4 votes vote down vote up
public Stat(Pointer p) {
    super(p);
    setAlignType(Structure.ALIGN_NONE);
    unpack();
}
 
Example #30
Source File: NotesCollationStruct.java    From domino-jna with Apache License 2.0 4 votes vote down vote up
public NotesCollationStruct(Pointer peer) {
	super(peer);
	setAlignType(Structure.ALIGN_NONE);
}