DemuxOutputStream (Apache Ant API)
Keywords: org.apache.tools.ant.DemuxOutputStream class

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.tools.ant
Class DemuxOutputStream

    java.lang.Object
      java.io.OutputStream
          org.apache.tools.ant.DemuxOutputStream

public class DemuxOutputStream
extends java.io.OutputStream

Logs content written by a thread and forwards the buffers onto the project object which will forward the content to the appropriate task.

Since:
  1.4
Author:
  Conor MacNeill

Constructor Summary
`DemuxOutputStream(Project project, boolean isErrorStream)` Creates a new instance of this class.

Method Summary
`void` | `close()` Equivalent to flushing the stream.
`void` | `flush()` Writes all remaining data in the buffer associated with the current thread to the project.
`protected void` | `processBuffer(java.io.ByteArrayOutputStream buffer)` Converts the buffer to a string and sends it to the project.
`protected void` | `processFlush(java.io.ByteArrayOutputStream buffer)` Converts the buffer to a string and sends it to the project.
`void` | `write(int cc)` Writes the data to the buffer and flushes the buffer if a line separator is detected or if the buffer has reached its maximum size.

Methods inherited from class java.io.OutputStream
`write, write`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DemuxOutputStream

    public DemuxOutputStream(Project project,
                             boolean isErrorStream)

  Creates a new instance of this class.

Parameters:
  `project` - The project instance for which output is being demultiplexed. Must not be `null`.
  `isErrorStream` - `true` if this is the error string, otherwise a normal output stream. This is passed to the project so it knows which stream it is receiving.

Method Detail

### write

    public void write(int cc)
               throws java.io.IOException

  Writes the data to the buffer and flushes the buffer if a line separator is detected or if the buffer has reached its maximum size.

  Parameters:
    `cc` - data to log (byte).
  Throws:
    `java.io.IOException` - if the data cannot be written to the stream

### processBuffer

    protected void processBuffer(java.io.ByteArrayOutputStream buffer)

  Converts the buffer to a string and sends it to the project.

  Parameters:
    `buffer` - the ByteArrayOutputStream used to collect the output until a line separator is seen.
  See Also:
    `Project.demuxOutput(String,boolean)`

### processFlush

    protected void processFlush(java.io.ByteArrayOutputStream buffer)

  Converts the buffer to a string and sends it to the project.

  Parameters:
    `buffer` - the ByteArrayOutputStream used to collect the output until a line separator is seen.
  See Also:
    `Project.demuxOutput(String,boolean)`

### close

    public void close()
               throws java.io.IOException

  Equivalent to flushing the stream.

  Throws:
    `java.io.IOException` - if there is a problem closing the stream.
  See Also:
    `flush()`

### flush

    public void flush()
               throws java.io.IOException

  Writes all remaining data in the buffer associated with the current thread to the project.

  Throws:
    `java.io.IOException` - if there is a problem flushing the stream.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2003 Apache Software Foundation. All Rights Reserved.