|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.jini.tool.envcheck.EnvCheck.Pipe
private class EnvCheck.Pipe
An I/O redirection pipe. A daemon thread copies data from an input stream to an output stream. An optional annotation may be provided which will prefix each line of the copied data with a label which can be used to identify the source.
Field Summary | |
---|---|
private String |
annotation
the output stream annotation |
private ByteArrayOutputStream |
bufOut
output line buffer |
private InputStream |
in
the input stream |
private Thread |
outThread
the thread to process the data |
private static byte |
SEPARATOR
the line separator character |
private PrintStream |
stream
the output PrintStream |
Constructor Summary | |
---|---|
EnvCheck.Pipe(String name,
InputStream in,
PrintStream stream,
String a)
Create a new Pipe object and start the thread to handle the data. |
Method Summary | |
---|---|
void |
run()
Read and write data until EOF is detected. |
(package private) void |
waitTillEmpty(int timeout)
Wait until the run method terminates due to reading EOF on input |
private void |
write(byte b)
If not annotated, write the byte to the stream immediately. |
private void |
write(byte[] b,
int len)
Write each byte in the give byte array. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final byte SEPARATOR
private ByteArrayOutputStream bufOut
private InputStream in
private PrintStream stream
private String annotation
private Thread outThread
Constructor Detail |
---|
EnvCheck.Pipe(String name, InputStream in, PrintStream stream, String a)
name
- the name to assign to the threadin
- input stream from which pipe input flowsstream
- the stream to which output will be senta
- the annotation for prepending text to logged linesMethod Detail |
---|
void waitTillEmpty(int timeout)
timeout
- max time to wait for the thread to terminatepublic void run()
run
in interface Runnable
private void write(byte[] b, int len) throws IOException
b
- the array of input byteslen
- the number data bytes in the array
IOException
private void write(byte b) throws IOException
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |