public interface GenericStreamIODevice extends GenericDevice
GenericStreamIODevice
interface defines generic methods for accessing and controlling peripheral devices
capable of working with input and output streams.
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 |
---|---|
void |
close()
Closes and releases the underlying peripheral device, making it available to other applications.
|
java.io.InputStream |
getInputStream()
Returns an input stream to this device.
|
java.io.OutputStream |
getOutputStream()
Returns an output stream to this device.
|
getControl, setControl, setEventListener
getID, getName, getProperties, isOpen
java.io.InputStream getInputStream() throws java.io.IOException, PeripheralNotAvailableException
InputStream
instance is returned upon subsequent calls. GenericEvent
with ID
GenericEvent.INPUT_DATA_AVAILABLE
.java.io.IOException
- if an IO error occurred such as the device is not readable.PeripheralNotAvailableException
- if the peripheral is not currently available (has been closed).java.io.OutputStream getOutputStream() throws java.io.IOException, PeripheralNotAvailableException
OutputStream
instance is returned upon subsequent
calls. GenericEvent
with ID
GenericEvent.OUTPUT_BUFFER_EMPTY
.java.io.IOException
- if an IO error occurred such as the device is not writable.PeripheralNotAvailableException
- if the peripheral is not currently available (has been closed).void close() throws java.io.IOException
Peripheral
instance will result in a
PeripheralNotAvailableException
being thrown.
This method has no effects if the peripheral device has already been closed.
Closing a GenericStreamIODevice
will also close the device's InputStream
and OutputStream
.close
in interface Peripheral
java.io.IOException
- if an I/O error occurs.Copyright (c) 2012, Oracle and/or its affiliates. All Rights Reserved. Use of this specification is subject to license terms.