public interface GenericBufferIODevice extends GenericDevice, java.nio.channels.ByteChannel, BufferAccess<java.nio.ByteBuffer>
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, setEventListener
getInputBuffer, getOutputBuffer
int read(java.nio.ByteBuffer dst) throws java.io.IOException, UnavailableDeviceException, ClosedDeviceException
GenericEvent
with ID GenericEvent.INPUT_DATA_AVAILABLE
. read
in interface java.nio.channels.ReadableByteChannel
dst
- The buffer into which bytes are to be transferred.dst
, possibly zero, or -1
if the device has reached
end-of-streamjava.lang.NullPointerException
- If dst
is null
.UnavailableDeviceException
- if this device is not currently available - such as it is locked by another
application.ClosedDeviceException
- if the device 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, UnavailableDeviceException, ClosedDeviceException
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.dst
, possibly zero, or -1
if the device has reached
end-of-streamjava.lang.NullPointerException
- If dst
is null
.java.lang.IllegalArgumentException
- If skip
is negative.UnavailableDeviceException
- if this device is not currently available - such as it is locked by another
application.ClosedDeviceException
- if the device 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, UnavailableDeviceException, ClosedDeviceException
GenericEvent
with ID GenericEvent.OUTPUT_BUFFER_EMPTY
. write
in interface java.nio.channels.WritableByteChannel
src
- The buffer from which bytes are to be retrieved.src
, possibly zero.java.lang.NullPointerException
- If src
is null
.UnavailableDeviceException
- if this device is not currently available - such as it is locked by another
application.ClosedDeviceException
- if the device has been closed.java.io.IOException
- if an I/O error occurred such as the device is not writable.Copyright © 2012, 2014, Oracle and/or its affiliates. All rights reserved.
Legal Notices