Gridarta Editor
|
Public Member Functions | |
CopyReader (@NotNull final Reader reader) | |
String | getFailure () |
String | getOutput () |
void | join () throws InterruptedException |
void | start () |
void | stop () |
Private Member Functions | |
void | setFailure (@NotNull final String failure) |
Private Attributes | |
final CharArrayWriter | charArrayWriter = new CharArrayWriter() |
String | failure |
final Reader | reader |
final Runnable | runnable |
boolean | stopped |
final Object | sync = new Object() |
final Thread | thread = new Thread(runnable) |
Copies a Reader into a String.
Definition at line 32 of file CopyReader.java.
net.sf.gridarta.utils.CopyReader.CopyReader | ( | @NotNull final Reader | reader | ) |
Creates a new instance.
reader | the reader to read from |
Definition at line 103 of file CopyReader.java.
References net.sf.gridarta.utils.CopyReader.reader.
String net.sf.gridarta.utils.CopyReader.getFailure | ( | ) |
Returns the failure reason.
Definition at line 140 of file CopyReader.java.
References net.sf.gridarta.utils.CopyReader.failure, net.sf.gridarta.utils.CopyReader.stopped, net.sf.gridarta.utils.CopyReader.sync, and net.sf.gridarta.utils.CopyReader.thread.
String net.sf.gridarta.utils.CopyReader.getOutput | ( | ) |
Returns the reader's output.
Definition at line 153 of file CopyReader.java.
References net.sf.gridarta.utils.CopyReader.charArrayWriter, net.sf.gridarta.utils.CopyReader.stopped, net.sf.gridarta.utils.CopyReader.sync, and net.sf.gridarta.utils.CopyReader.thread.
void net.sf.gridarta.utils.CopyReader.join | ( | ) | throws InterruptedException |
Waits for the worker thread to terminate.
InterruptedException | if the current thread was interrupted waiting for the worker thread to terminate |
Definition at line 166 of file CopyReader.java.
References net.sf.gridarta.utils.CopyReader.thread.
|
private |
Sets the failure reason. Does nothing if a preceding failure reason was recorded.
failure | the failure reason |
Definition at line 126 of file CopyReader.java.
References net.sf.gridarta.utils.CopyReader.failure, net.sf.gridarta.utils.CopyReader.stopped, and net.sf.gridarta.utils.CopyReader.sync.
void net.sf.gridarta.utils.CopyReader.start | ( | ) |
Starts reading.
Definition at line 110 of file CopyReader.java.
References net.sf.gridarta.utils.CopyReader.thread.
void net.sf.gridarta.utils.CopyReader.stop | ( | ) |
Stops reading.
Definition at line 117 of file CopyReader.java.
References net.sf.gridarta.utils.CopyReader.thread.
|
private |
The CharArrayWriter collecting data read from reader.
Definition at line 51 of file CopyReader.java.
Referenced by net.sf.gridarta.utils.CopyReader.getOutput().
|
private |
The failure reason. Set to
if no failure occurred.
Definition at line 62 of file CopyReader.java.
Referenced by net.sf.gridarta.utils.CopyReader.getFailure(), and net.sf.gridarta.utils.CopyReader.setFailure().
|
private |
The Reader to read from.
Definition at line 38 of file CopyReader.java.
Referenced by net.sf.gridarta.utils.CopyReader.CopyReader().
|
private |
The Runnable implementing the worker thread.
Definition at line 68 of file CopyReader.java.
|
private |
Whether the worker thread was stopped.
Definition at line 56 of file CopyReader.java.
Referenced by net.sf.gridarta.utils.CopyReader.getFailure(), net.sf.gridarta.utils.CopyReader.getOutput(), and net.sf.gridarta.utils.CopyReader.setFailure().
|
private |
The synchronization object for accessing stopped, {}, and #charArrayWriter}.
Definition at line 45 of file CopyReader.java.
Referenced by net.sf.gridarta.utils.CopyReader.getFailure(), net.sf.gridarta.utils.CopyReader.getOutput(), and net.sf.gridarta.utils.CopyReader.setFailure().
|
private |
The worker Thread executing runnable.
Definition at line 97 of file CopyReader.java.
Referenced by net.sf.gridarta.utils.CopyReader.getFailure(), net.sf.gridarta.utils.CopyReader.getOutput(), net.sf.gridarta.utils.CopyReader.join(), net.sf.gridarta.utils.CopyReader.start(), and net.sf.gridarta.utils.CopyReader.stop().