|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.io.InputStream | +--edu.nmu.io.DelegatedInputStream
Reads input from another InputStream
By using delegation as a level of abstraction, applications can change the source of input without needing to reference a new InputStream. This is especially useful for changing the source of input for final references such as System.in
It is important to note that this class is not
thread safe. A call to the delegated
InputStream could forseeably hang waiting for
new input while another Thread calls
setStream(InputStream)
Constructor Summary | |
DelegatedInputStream(java.io.InputStream in)
Creates a new DelegatedInputStream from the specified InputStream |
Method Summary | |
int |
available()
|
void |
close()
|
java.io.InputStream |
getStream()
Gets the InputStream used for delegation |
void |
mark(int readlimit)
|
boolean |
markSupported()
|
int |
read()
|
int |
read(byte[] b)
|
int |
read(byte[] b,
int off,
int len)
|
void |
reset()
|
void |
setStream(java.io.InputStream in)
Sets a new InputStream to be used for delegation |
long |
skip(long n)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DelegatedInputStream(java.io.InputStream in)
in
- the InputStream to which calls should
be delegatedMethod Detail |
public int read() throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public int available() throws java.io.IOException
available
in class java.io.InputStream
java.io.IOException
public void close() throws java.io.IOException
close
in class java.io.InputStream
java.io.IOException
public void mark(int readlimit)
mark
in class java.io.InputStream
public boolean markSupported()
markSupported
in class java.io.InputStream
public int read(byte[] b) throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public int read(byte[] b, int off, int len) throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public void reset() throws java.io.IOException
reset
in class java.io.InputStream
java.io.IOException
public long skip(long n) throws java.io.IOException
skip
in class java.io.InputStream
java.io.IOException
public java.io.InputStream getStream()
public void setStream(java.io.InputStream in)
in
- the InputStream to which calls should
be delegated
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |