public class DeviceException extends IOException
DeviceException
is a special IOException
, which is thrown to
indicate that there is a device operation fail. The error reason can be
located with getCode()
method. The cause is available with
Throwable.getCause()
.Modifier and Type | Field and Description |
---|---|
static int |
COMMUNICATION_ERROR
An exception code indicates that there is an error in the communication.
|
static int |
NO_DATA
An exception code indicates that the requested value is currently not
available.
|
static int |
NOT_INITIALIZED
An exception code indicates that the device is not initialized.
|
static int |
TIMEOUT
An exception code indicates that there is expired timeout without any
processing.
|
static int |
UNKNOWN
An exception code indicates that the error is unknown.
|
Constructor and Description |
---|
DeviceException()
Construct a new device exception with
null message. |
DeviceException(String message)
Constructs a new device exception with the given message.
|
DeviceException(String message,
Throwable cause)
Constructs a new device exception with the given message and cause.
|
DeviceException(String message,
Throwable cause,
int code)
Constructs a new device exception with the given message, cause and code.
|
Modifier and Type | Method and Description |
---|---|
int |
getCode()
Returns the exception code.
|
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
public static final int UNKNOWN
public static final int COMMUNICATION_ERROR
public static final int TIMEOUT
public static final int NOT_INITIALIZED
Device.STATUS_NOT_INITIALIZED
or
Device.STATUS_PROCESSING
.public static final int NO_DATA
public DeviceException()
null
message. The cause is
not initialized and the exception code is set to UNKNOWN
.public DeviceException(String message)
UNKNOWN
.message
- The exception message.public DeviceException(String message, Throwable cause)
UNKNOWN
.message
- The exception message.cause
- The exception cause.public int getCode()
UNKNOWN
COMMUNICATION_ERROR
TIMEOUT
NOT_INITIALIZED
NO_DATA
Copyright © Contributors to the Eclipse Foundation Licensed under the Eclipse Foundation Specification License – v1.0