Package com.kosdev.kos.core.service.udev
Class UsbId
java.lang.Object
com.kosdev.kos.core.service.udev.UsbId
Represents the id of a usb device by vendorId / productId. This includes
support for equality to make various comparisons easy.
- Since:
- 9
- Version:
- 10
-
Constructor Summary
ConstructorsConstructorDescriptionUsbId(int vendorId, int productId) Create a new id using the specified vendorId and productId.Create a new id using the specifiedvendorId:productIdstring format which is%04X:%04X.Create a new id using the specifiedvendorId:productIdstring format which is%04X:%04X. -
Method Summary
Modifier and TypeMethodDescriptionbooleanequals(int vendorId, int productId) Check if this id matches the supplied productId / vendorId.booleanintintinthashCode()booleanisValid()Return true if theUsbIdcontains a valid vendorId / productId.voidsetProductId(int productId) voidsetVendorId(int vendorId) toString()
-
Constructor Details
-
UsbId
public UsbId(int vendorId, int productId) Create a new id using the specified vendorId and productId.- Parameters:
vendorId- the usb vendor idproductId- the usb product id- Since:
- 9
-
UsbId
Create a new id using the specifiedvendorId:productIdstring format which is%04X:%04X. If the string cannot be parsed or is invalid, the resultingUsbIdwill be invalid (callingisValidwill return false).- Parameters:
vidpid- the vendorId:productId string- Since:
- 10
-
UsbId
Create a new id using the specifiedvendorId:productIdstring format which is%04X:%04X. The exception flag determines how the constructor should behave if the string is invalid. If the flag is true, an invalid value will throw aReasonException. If the flag is false, the constructor will be successful butisValid()will return false.- Parameters:
vidpid- the vendorId:productId stringexception- true to throw an exception for invalid vid:pid- Since:
- 10
-
-
Method Details
-
isValid
public boolean isValid()Return true if theUsbIdcontains a valid vendorId / productId. -
equals
public boolean equals(int vendorId, int productId) Check if this id matches the supplied productId / vendorId.- Parameters:
vendorId- the usb vendor idproductId- the usb product id- Since:
- 9
-
toString
-
getVendorId
public int getVendorId() -
getProductId
public int getProductId() -
setVendorId
public void setVendorId(int vendorId) -
setProductId
public void setProductId(int productId) -
equals
-
hashCode
public int hashCode()
-