Package com.ibm.di.api.remote.impl.rmi
Class InputStreamWrapper
- java.lang.Object
-
- java.io.InputStream
-
- com.ibm.di.api.remote.impl.rmi.InputStreamWrapper
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class InputStreamWrapper extends java.io.InputStream
A wrapper class ofInputStream
class for use by the RMI.
-
-
Constructor Summary
Constructors Constructor Description InputStreamWrapper(java.io.InputStream aIstream, java.net.Socket aSocket)
Constructs InputStreamWrapper by given InputStream object and Socket or SSLSocket object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
available()
Returns the number of bytes that can be read (or skipped over) from this input stream without blocking by the next caller of a method for this input stream.void
close()
Closes this input stream and releases any system resources associated with the stream.void
mark(int aReadLimit)
Marks the current position in this stream.boolean
markSupported()
Tests if this stream supports themark
andreset
methods.int
read()
Reads the next byte of data from the input stream.int
read(byte[] aBarray)
Reads some number of bytes from the input stream and stores them into the buffer arrayaBarray
.int
read(byte[] aBarray, int aOff, int aLen)
Reads up toaLen
bytes of data from the input stream into an array of bytes.void
reset()
Repositions this stream to the position at the time the mark method was last called on this input streamlong
skip(long aN)
Skips over and discards n bytes of data from this stream.
-
-
-
Method Detail
-
read
public int read() throws java.io.IOException
Reads the next byte of data from the input stream.- Specified by:
read
in classjava.io.InputStream
- Returns:
- the next byte of data, or -1 if the end of the stream is reached.
- Throws:
java.io.IOException
- if an I/O error occurs
-
read
public int read(byte[] aBarray) throws java.io.IOException
Reads some number of bytes from the input stream and stores them into the buffer arrayaBarray
.- Overrides:
read
in classjava.io.InputStream
- Parameters:
aBarray
- the buffer into which the data is read.- Returns:
- the total number of bytes read into the buffer, or -1 is there is no more data because the end of the stream has been reached.
- Throws:
java.io.IOException
- if an I/O error occurs. NullPointerException ifaBarray
is null
-
read
public int read(byte[] aBarray, int aOff, int aLen) throws java.io.IOException
Reads up toaLen
bytes of data from the input stream into an array of bytes.- Overrides:
read
in classjava.io.InputStream
- Parameters:
aBarray
- the buffer into which the data is read.aOff
- the start offset in arrayaBarray
at which the data is written.aLen
- the maximum number of bytes to read.- Returns:
- the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.
- Throws:
java.io.IOException
- if an I/O error occurs.java.lang.NullPointerException
- ifaBarray
is null.
-
skip
public long skip(long aN) throws java.io.IOException
Skips over and discards n bytes of data from this stream.- Overrides:
skip
in classjava.io.InputStream
- Parameters:
aN
- the number of bytes to be skipped. Returns: the actual number of bytes skipped. Throws: IOException if an I/O error occurs.- Returns:
- the actual number of bytes skipped.
- Throws:
java.io.IOException
- if an I/O error occurs
-
available
public int available() throws java.io.IOException
Returns the number of bytes that can be read (or skipped over) from this input stream without blocking by the next caller of a method for this input stream. The next caller might be the same thread or another thread.- Overrides:
available
in classjava.io.InputStream
- Returns:
- the number of bytes that can be read from this input stream without blocking.
- Throws:
java.io.IOException
- if an I/O error occurs
-
close
public void close() throws java.io.IOException
Closes this input stream and releases any system resources associated with the stream.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classjava.io.InputStream
- Throws:
java.io.IOException
- if an I/O error occurs
-
mark
public void mark(int aReadLimit)
Marks the current position in this stream. A subsequent call to the reset method repositions this stream at the last marked position so that subsequent reads re-read the same bytes.- Overrides:
mark
in classjava.io.InputStream
- Parameters:
aReadLimit
- the maximum limit of bytes that can be read before the mark position becomes invalid- See Also:
reset()
-
reset
public void reset() throws java.io.IOException
Repositions this stream to the position at the time the mark method was last called on this input stream- Overrides:
reset
in classjava.io.InputStream
- Throws:
java.io.IOException
- if this stream has not been marked or if the mark has been invalidated- See Also:
mark(int)
-
markSupported
public boolean markSupported()
Tests if this stream supports themark
andreset
methods. Whether or not mark and reset are supported is an invariant property of the this stream instance.- Overrides:
markSupported
in classjava.io.InputStream
- Returns:
true
if this stream instance supports the mark and reset methods;false
otherwise.
-
-