qflib 0.98.0

de.qfs.lib.util
Class StablePipedOutputStream

java.lang.Object
  |
  +--java.io.OutputStream
        |
        +--java.io.PipedOutputStream
              |
              +--de.qfs.lib.util.StablePipedOutputStream

public class StablePipedOutputStream
extends java.io.PipedOutputStream

A StablePipedOutputStream extends PipedOutputStream to pass all data written to it through the same thread to avoid broken pipes when writing within a temporary thread.

Version:
$Revision: 1.4 $
Author:
Gregor Schmid

Constructor Summary
StablePipedOutputStream()
          Create a new StablePipedOutputStream.
StablePipedOutputStream(java.io.PipedInputStream sink)
          Create a new StablePipedOutputStream for a PipedInputStream.
 
Method Summary
 void close()
          Close this output stream and release any system resources associated with this stream.
 void write(byte[] b, int off, int len)
          Write len bytes from the specified byte array starting at offset off to this output stream.
 void write(int b)
          Write the specified byte to this output stream.
 
Methods inherited from class java.io.PipedOutputStream
connect, flush
 
Methods inherited from class java.io.OutputStream
write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StablePipedOutputStream

public StablePipedOutputStream()
Create a new StablePipedOutputStream.

StablePipedOutputStream

public StablePipedOutputStream(java.io.PipedInputStream sink)
                        throws java.io.IOException
Create a new StablePipedOutputStream for a PipedInputStream.
Parameters:
sink - The target for the data.
Throws:
java.io.IOException - If an I/O error occurs.
Method Detail

write

public void write(byte[] b,
                  int off,
                  int len)
           throws java.io.IOException
Write len bytes from the specified byte array starting at offset off to this output stream.
Overrides:
write in class java.io.PipedOutputStream
Parameters:
b - The array.
off - The offset.
len - The number of bytes.
Throws:
java.io.IOException - If an I/O error occurs.

write

public void write(int b)
           throws java.io.IOException
Write the specified byte to this output stream.
Overrides:
write in class java.io.PipedOutputStream
Parameters:
b - The byte to write.
Throws:
java.io.IOException - If an I/O error occurs.

close

public void close()
           throws java.io.IOException
Close this output stream and release any system resources associated with this stream.
Overrides:
close in class java.io.PipedOutputStream
Throws:
java.io.IOException - If an I/O error occurs.

qflib 0.98.0