public class StreamReaderThread extends java.lang.Thread
getException()
. So if the caller wants to ensure that the content is
really complete, he not only has to wait for the end of the thread via join,
but also check this method.Constructor and Description |
---|
StreamReaderThread(java.io.InputStream input)
Create a new reader that reads the content of this stream in its own
thread.
|
StreamReaderThread(java.io.InputStream input,
java.nio.charset.Charset charset)
Create a new reader that reads the content of this stream in its own
thread.
|
StreamReaderThread(java.io.InputStream input,
java.nio.charset.Charset charset,
boolean storeContent)
Create a new reader that reads the content of this stream in its own
thread.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getContent()
Returns the content read from the stream.
|
java.io.IOException |
getException()
If everything went ok during reading from the stream, this returns null.
|
void |
run()
Reads content from the stream as long as the stream is not empty.
|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
public StreamReaderThread(java.io.InputStream input)
This constructor causes the content to be stored.
input
- Stream to read from. This stream is not automatically closed,
but must be closed by the caller (if this is intended).public StreamReaderThread(java.io.InputStream input, java.nio.charset.Charset charset)
This constructor causes the content to be stored.
input
- Stream to read from. This stream is not automatically closed,
but must be closed by the caller (if this is intended).charset
- Character set to be used to convert the stream into a string.public StreamReaderThread(java.io.InputStream input, java.nio.charset.Charset charset, boolean storeContent)
input
- Stream to read from. This stream is not automatically closed,
but must be closed by the caller (if this is intended).public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public java.lang.String getContent()
public java.io.IOException getException()