public interface GenericBufferIODevice extends GenericDevice, java.nio.channels.ByteChannel, BufferAccess<java.nio.ByteBuffer>
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| Modifier and Type | Method and Description |
|---|---|
int |
read(java.nio.ByteBuffer dst)
Reads a sequence of bytes from this device into the given buffer.
|
int |
read(int skip,
java.nio.ByteBuffer dst)
Reads a sequence of bytes from this device into the given buffer, skipping the first
skip bytes read. |
int |
write(java.nio.ByteBuffer src)
Writes a sequence of bytes to this device from the given buffer.
|
getControl, setControl, setEventListenerclose, getDescriptor, isOpen, tryLock, unlockgetInputBuffer, getOutputBufferint read(java.nio.ByteBuffer dst)
throws java.io.IOException,
UnavailablePeripheralException,
ClosedPeripheralException
GenericEvent with ID
GenericEvent.INPUT_DATA_AVAILABLE. read in interface java.nio.channels.ReadableByteChanneldst - The buffer into which bytes are to be transferred.-1 if the device has reached end-of-streamjava.lang.NullPointerException - If dst is null.UnavailablePeripheralException - if this peripheral is not currently available - such as it is locked by another application.ClosedPeripheralException - if the peripheral has been closed.java.io.IOException - if an I/O error occurred such as the device is not readable.int read(int skip,
java.nio.ByteBuffer dst)
throws java.io.IOException,
UnavailablePeripheralException,
ClosedPeripheralException
skip bytes read.
Apart from skipping the first skip bytes, this method behaves identically to
read(java.nio.ByteBuffer).skip - the number of read bytes that must be ignored/skipped before filling in the dst buffer.dst - The buffer into which bytes are to be transferred.-1 if the device has reached end-of-streamjava.lang.NullPointerException - If dst is null.UnavailablePeripheralException - if this peripheral is not currently available - such as it is locked by another application.ClosedPeripheralException - if the peripheral has been closed.java.io.IOException - if an I/O error occurred such as the device is not readable.int write(java.nio.ByteBuffer src)
throws java.io.IOException,
UnavailablePeripheralException,
ClosedPeripheralException
GenericEvent with ID
GenericEvent.OUTPUT_BUFFER_EMPTY.
write in interface java.nio.channels.WritableByteChannelsrc - The buffer from which bytes are to be retrieved.java.lang.NullPointerException - If src is null.UnavailablePeripheralException - if this peripheral is not currently available - such as it is locked by another application.ClosedPeripheralException - if the peripheral has been closed.java.io.IOException - if an I/O error occurred such as the device is not writable.Copyright © 2012, 2013, Oracle and/or its affiliates. All rights reserved.
Legal Notices