P - the device type the descriptor is defined for.public abstract class AbstractDevice<P extends Device<? super P>> extends java.lang.Object implements Device<P>
AbstractDevice class is the base implementation for
Device-implementing classes instantiated by DeviceProvider.
DeviceDescriptor of Device instances.BIG_ENDIAN, LITTLE_ENDIAN, MIXED_ENDIAN| Constructor and Description |
|---|
AbstractDevice() |
| Modifier and Type | Method and Description |
|---|---|
<U extends P> |
getDescriptor()
Retrieves the identifying and descriptive information of this device
device.
|
void |
tryLock(int timeout)
Attempts to lock for exclusive access the underlying
device resource.
|
void |
unlock()
Releases from exclusive access the underlying
device resource.
|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclose, getByteOrder, isOpenpublic void tryLock(int timeout)
throws UnavailableDeviceException,
ClosedDeviceException,
java.io.IOException
timeout of 0
means to wait forever.
This method returns silently if the underlying device resource is currently acquired for exclusive access.
tryLock in interface Device<P extends Device<? super P>>timeout - the timeout in milliseconds.java.lang.IllegalArgumentException - if timeout is negative.UnavailableDeviceException - if this device is not
currently available.ClosedDeviceException - if this device has been closed.java.io.IOException - if any other I/O error occurred.public void unlock()
throws java.io.IOException
This method returns silently if the underlying device resource is not currently acquired for exclusive access or has already been closed.
public final <U extends P> DeviceDescriptor<U> getDescriptor()
getDescriptor in interface Device<P extends Device<? super P>>U - this Device type or a subtype of it (allows for
subclassing Device types - see
UART and
ModemUART).DeviceDescriptor which encapsulates the
identifying and descriptive information of this device.Copyright © 2012, 2015, Oracle and/or its affiliates. All rights reserved.
Legal Notices