class PipeWriter extends Object implements Runnable
Modifier and Type | Field and Description |
---|---|
private ByteArrayOutputStream |
bufOut
stream used for buffering lines
|
private int |
cLast
count since last separator
|
private byte[] |
currSep
current chunk of input being compared to lineSeparator.
|
private Object[] |
date |
private String |
execString |
private static String |
format |
private static MessageFormat |
formatter |
private InputStream |
in |
private static String |
lineSeparator |
private static int |
lineSeparatorLength |
private PrintWriter |
out |
Modifier | Constructor and Description |
---|---|
private |
PipeWriter(InputStream in,
OutputStream out,
String name,
String tag)
Create a new PipeWriter object.
|
Modifier and Type | Method and Description |
---|---|
private String |
createAnnotation()
Create an annotation string to be printed out after
a new line and end of stream.
|
(package private) static void |
plugTogetherPair(String name,
InputStream in,
OutputStream out,
InputStream in1,
OutputStream out1)
Allow plugging together two pipes at a time, to associate
output from an exec'ed process.
|
void |
run()
Create a thread to listen and read from input stream, in.
|
private void |
write(byte b)
Write a byte of data to the stream.
|
private void |
write(byte[] b,
int off,
int len)
Write a subarray of bytes.
|
private final ByteArrayOutputStream bufOut
private int cLast
private final byte[] currSep
private final PrintWriter out
private final InputStream in
private final String execString
private final Object[] date
private static final String lineSeparator
private static final int lineSeparatorLength
private static final String format
private static final MessageFormat formatter
private PipeWriter(InputStream in, OutputStream out, String name, String tag)
in
- input stream from which pipe input flowsout
- output stream to which log messages will be sentname
- name of the processtag
- name of the stream (out or err)public void run()
private void write(byte[] b, int off, int len) throws IOException
IOException
private void write(byte b) throws IOException
IOException
private String createAnnotation()
static void plugTogetherPair(String name, InputStream in, OutputStream out, InputStream in1, OutputStream out1)
name
- name of the processin
- input stream from which pipe input comesout
- output stream to which log messages will be sentin1
- input stream from which pipe input comesout1
- output stream to which log messages will be sentCopyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.