Package org.apache.tools.ant.util
Class LeadPipeInputStream
- java.lang.Object
-
- java.io.InputStream
-
- java.io.PipedInputStream
-
- org.apache.tools.ant.util.LeadPipeInputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public class LeadPipeInputStream extends java.io.PipedInputStreamSpecialPipedInputStreamthat will not die when the writingThreadis no longer alive.- Since:
- Ant 1.6.2
-
-
Constructor Summary
Constructors Constructor Description LeadPipeInputStream()Construct a newLeadPipeInputStream.LeadPipeInputStream(int size)Construct a newLeadPipeInputStreamwith the specified buffer size.LeadPipeInputStream(java.io.PipedOutputStream src)Construct a newLeadPipeInputStreamto pull from the specifiedPipedOutputStream.LeadPipeInputStream(java.io.PipedOutputStream src, int size)Construct a newLeadPipeInputStreamto pull from the specifiedPipedOutputStream, using a circular buffer of the specified size.
-
Method Summary
Modifier and Type Method Description voidlog(java.lang.String message, int loglevel)Log a message with the specified logging level.intread()Read a byte from the stream.voidsetBufferSize(int size)Set the size of the buffer.voidsetManagingComponent(ProjectComponent pc)Set a managingProjectComponentfor thisLeadPipeInputStream.voidsetManagingTask(Task task)Set a managingTaskfor thisLeadPipeInputStream.
-
-
-
Constructor Detail
-
LeadPipeInputStream
public LeadPipeInputStream()
Construct a newLeadPipeInputStream.
-
LeadPipeInputStream
public LeadPipeInputStream(int size)
Construct a newLeadPipeInputStreamwith the specified buffer size.- Parameters:
size- the size of the circular buffer.
-
LeadPipeInputStream
public LeadPipeInputStream(java.io.PipedOutputStream src) throws java.io.IOExceptionConstruct a newLeadPipeInputStreamto pull from the specifiedPipedOutputStream.- Parameters:
src- thePipedOutputStreamsource.- Throws:
java.io.IOException- if unable to construct the stream.
-
LeadPipeInputStream
public LeadPipeInputStream(java.io.PipedOutputStream src, int size) throws java.io.IOExceptionConstruct a newLeadPipeInputStreamto pull from the specifiedPipedOutputStream, using a circular buffer of the specified size.- Parameters:
src- thePipedOutputStreamsource.size- the size of the circular buffer.- Throws:
java.io.IOException- if there is an error.
-
-
Method Detail
-
read
public int read() throws java.io.IOExceptionRead a byte from the stream.- Overrides:
readin classjava.io.PipedInputStream- Returns:
- the byte (0 to 255) or -1 if there are no more.
- Throws:
java.io.IOException- if there is an error.
-
setBufferSize
public void setBufferSize(int size)
Set the size of the buffer.- Parameters:
size- the new buffer size. Ignored if <= current size.
-
setManagingTask
public void setManagingTask(Task task)
Set a managingTaskfor thisLeadPipeInputStream.- Parameters:
task- the managingTask.
-
setManagingComponent
public void setManagingComponent(ProjectComponent pc)
Set a managingProjectComponentfor thisLeadPipeInputStream.- Parameters:
pc- the managingProjectComponent.
-
log
public void log(java.lang.String message, int loglevel)Log a message with the specified logging level.- Parameters:
message- theStringmessage.loglevel- theintlogging level.
-
-