Package org.jppf.nio
Interface NioObject
- All Known Implementing Classes:
AbstractNioObject,PlainNioObject,SSLNioObject
public interface NioObject
Abstraction of a sequence of data read from, or written to a data channel.
The size of the data is known before the read or write operation.
Furthermore, multiple calls to the read() or write() method may be required
for the read or write operation to complete. This implies that an implementation of this interface
should keep state information between calls.
- Author:
- Laurent Cohen
-
Method Summary
Modifier and TypeMethodDescriptionlongGet the actual bytes sent to or received from the underlying channel.getData()Location of the data to read or write.intgetSize()Get the size of the data ot send or receive.booleanread()Attempt to read an object from an inbound channel.reset()Reset this object.booleanwrite()Attempt to write an object to an outbound channel.
-
Method Details
-
read
Attempt to read an object from an inbound channel.- Returns:
trueif an object was fully read,falseotherwise.- Throws:
Exception- if any error occurs.
-
write
Attempt to write an object to an outbound channel.- Returns:
trueif an object was fully written,falseotherwise.- Throws:
Exception- if any error occurs.
-
getData
DataLocation getData()Location of the data to read or write.- Returns:
- a
DataLocationinstance.
-
getSize
int getSize()Get the size of the data ot send or receive.- Returns:
- the size as an int.
-
getChannelCount
long getChannelCount()Get the actual bytes sent to or received from the underlying channel.- Returns:
- the number of bytes as a long value.
-
reset
NioObject reset()Reset this object.- Returns:
- an Object of the same class.
-