/** * Gets a list of slots that can accept tokens that are compatible with this * module; e.g. a list of PC/SC smart card readers. The parameter determines * if the method returns all compatible slots or only those in which there * is a compatible token present. * * @param tokenPresent * Can be SlotRequirement.ALL_SLOTS or * SlotRequirement.TOKEN_PRESENT. * @return An array of Slot objects. May be an empty array but not null. * @exception TokenException * If . * @preconditions * @postconditions (result <> null) */ public Slot[] getSlotList(boolean tokenPresent) throws TokenException { long[] slotIDs; try { slotIDs = pkcs11Module.C_GetSlotList(tokenPresent); } catch (sun.security.pkcs11.wrapper.PKCS11Exception ex) { throw new PKCS11Exception(ex); } Slot[] slots = new Slot[slotIDs.length]; for (int i = 0; i < slots.length; i++) { slots[i] = new Slot(this, slotIDs[i]); } return slots; }