public interface GenericBufferIODevice extends GenericDevice
GenericBufferIODevice interface defines generic methods for accessing and controlling peripheral devices
using read and write operations.
A platform implementer may allow through this interface access and control of peripheral devices for which there
exist no other more specific API such as SPIDevice or I2CDevice.BIG_ENDIAN, LITTLE_ENDIAN, MIXED_ENDIAN, UNDEFINED_ID| Modifier and Type | Method and Description |
|---|---|
int |
read(byte[] rxBuf,
int rxOff,
int rxLen)
Reads up to
rxLen bytes of data from this device into an array of bytes. |
int |
read(int skip,
byte[] rxBuf,
int rxOff,
int rxLen)
Reads up to
rxLen bytes of data from this device into an array of bytes skipping the first skip
bytes read. |
void |
write(byte[] txBuf,
int txOff,
int txLen)
Writes to this device
txLen bytes from buffer txBuf. |
getControl, setControl, setEventListenerclose, getID, getName, getProperties, isOpenint read(byte[] rxBuf,
int rxOff,
int rxLen)
throws java.io.IOException,
PeripheralNotAvailableException
rxLen bytes of data from this device into an array of bytes.
Note that the availability of new input data may be notified through an GenericEvent with ID
GenericEvent.INPUT_DATA_AVAILABLE.rxBuf - the buffer into which the data is read.rxOff - the offset in rxBuf where to start copying the bytes read.rxLen - the maximum number of bytes to read.java.io.IOException - if an IO error occurred such as the device is not readable.java.lang.NullPointerException - If rxBuf is null.java.lang.IndexOutOfBoundsException - rxOff or rxLen points or results in pointing outside rxBuf.PeripheralNotAvailableException - if the peripheral is not currently available (has been closed).int read(int skip,
byte[] rxBuf,
int rxOff,
int rxLen)
throws java.io.IOException,
PeripheralNotAvailableException
rxLen bytes of data from this device into an array of bytes skipping the first skip
bytes read.
Note that the availability of new input data may be notified through an GenericEvent with ID
GenericEvent.INPUT_DATA_AVAILABLE.skip - the number of read bytes that must be ignored/skipped before filling in the rxBuf buffer.rxBuf - the buffer into which the data is read.rxOff - the offset in rxBuf where to start copying the bytes read.rxLen - the maximum number of bytes to read.java.io.IOException - if an IO error occurred such as the device is not readable..java.lang.NullPointerException - If rxBuf is null.java.lang.IndexOutOfBoundsException - rxOff or rxLen points or results in pointing outside rxBuf.PeripheralNotAvailableException - if the peripheral is not currently available (has been closed).void write(byte[] txBuf,
int txOff,
int txLen)
throws java.io.IOException,
PeripheralNotAvailableException
txLen bytes from buffer txBuf.
Note that an empty output buffer condition may be notified through an GenericEvent with ID
GenericEvent.OUTPUT_BUFFER_EMPTY.txBuf - the buffer containing the bytes to write.txOff - the offset in txBuf of the first byte to write.txLen - the number of bytes from txBuf to write.java.io.IOException - if an IO error occurred such as the device is not writable.java.lang.NullPointerException - If txBuf is null.java.lang.IndexOutOfBoundsException - txOff or txLen points or results in pointing outside txBuf.PeripheralNotAvailableException - if the peripheral is not currently available (has been closed).Copyright (c) 2012, Oracle and/or its affiliates. All Rights Reserved. Use of this specification is subject to license terms.