Package org.jppf.io
Class SocketWrapperInputSource
java.lang.Object
org.jppf.io.SocketWrapperInputSource
- All Implemented Interfaces:
Closeable,AutoCloseable,InputSource,IO
Input source backed by a
SocketWrapper.- Author:
- Laurent Cohen
-
Field Summary
Fields inherited from interface org.jppf.io.IO
CHECK_LOW_MEMORY, EMPTY_BYTES, FREE_MEM_TO_SIZE_RATIO, GC_ON_DISK_OVERFLOW, LENGTH_BUFFER_POOL, LENGTH_BUFFER_POOL_SIZE, LOW_MEMORY_THRESHOLD, SOCKET_BUFFER_SIZE, SOCKET_KEEPALIVE, SOCKET_TCP_NODELAY, TEMP_BUFFER_POOL, TEMP_BUFFER_POOL_SIZE, TEMP_BUFFER_SIZE -
Constructor Summary
ConstructorsConstructorDescriptionSocketWrapperInputSource(SocketWrapper socketWrapper) Initialize this input source with the specifiedSocketWrapper. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()This method does nothing.intread(byte[] data, int offset, int len) Read data from this input source into an array of bytes.intread(ByteBuffer data) Read data from this input source into a byte buffer.intreadInt()Read an int value from this input source.intskip(int n) Skipnbytes of data form this input source.
-
Constructor Details
-
SocketWrapperInputSource
Initialize this input source with the specifiedSocketWrapper.- Parameters:
socketWrapper- the backingSocketWrapper.
-
-
Method Details
-
read
Read data from this input source into an array of bytes.- Specified by:
readin interfaceInputSource- Parameters:
data- the buffer into which to write.offset- the position in the buffer where to start storing the data.len- the size in bytes of the data to read.- Returns:
- the number of bytes actually read, or -1 if end of stream was reached.
- Throws:
Exception- if an IO error occurs.
-
read
Read data from this input source into a byte buffer.- Specified by:
readin interfaceInputSource- Parameters:
data- the buffer into which to write.- Returns:
- the number of bytes actually read, or -1 if end of stream was reached.
- Throws:
Exception- if an IO error occurs.
-
readInt
Read an int value from this input source.- Specified by:
readIntin interfaceInputSource- Returns:
- the value read, or -1 if an end of file condition was reached.
- Throws:
Exception- if an IO error occurs.
-
skip
Skipnbytes of data form this input source.- Specified by:
skipin interfaceInputSource- Parameters:
n- the number of bytes to skip.- Returns:
- the number of bytes actually skipped.
- Throws:
Exception- if an IO error occurs.
-
close
This method does nothing.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException- if an IO error occurs.
-