|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.uwyn.rife.tools.InputStreamUser<ResultType,DataType>
public abstract class InputStreamUser<ResultType,DataType>
By extending this class it's possible to provide the logic that should be
executed by methods that allow interaction with an InputStream.
This class has both a default constructor and one that can take a data
object. This can be handy when using it as an extending anonymous inner
class when you need to use variables inside the inner class that are
cumbersome to change to final in the enclosing class.
| Field Summary | |
|---|---|
protected DataType |
mData
|
| Constructor Summary | |
|---|---|
InputStreamUser()
|
|
InputStreamUser(DataType data)
|
|
| Method Summary | |
|---|---|
Object |
clone()
Simply clones the instance with the default clone method since this class contains no member variables. |
DataType |
getData()
|
void |
throwException(Exception exception)
Calling this method makes it possible to throw a checked exception from within this class. |
abstract ResultType |
useInputStream(InputStream stream)
Should be implemented by all extending classes. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected DataType mData
| Constructor Detail |
|---|
public InputStreamUser()
public InputStreamUser(DataType data)
| Method Detail |
|---|
public DataType getData()
public void throwException(Exception exception)
throws InnerClassException
To catch it you should surround the using method with a
try-catch block that catching
InnerClassException. The original exception is then
available through getCause() and can for example be
rethrown.
InnerClassException - when a checked exception needs to be
thrown from within this class and caught outside the caller.
public abstract ResultType useInputStream(InputStream stream)
throws InnerClassException
InnerClassExceptionpublic Object clone()
clone in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||