@@ -0,0 +1,1619 @@
+package com.hypirion.io;%0A%0Aimport java.io.InputStream;%0Aimport java.io.OutputStream;%0Aimport java.io.Writer;%0Aimport java.io.Reader;%0Aimport java.io.Closeable;%0Aimport java.io.IOException;%0A%0Apublic class ClosingPipe extends Pipe %7B%0A%0A    protected final Thread closer;%0A%0A    public ClosingPipe(InputStream in, OutputStream out) %7B%0A        this(in, out, DEFAULT_BUFFER_SIZE);%0A    %7D%0A%0A    public ClosingPipe(InputStream in, OutputStream out, int bufsize) %7B%0A        super(in, out, bufsize);%0A        closer = setupCloser(out);%0A    %7D%0A%0A    public ClosingPipe(Reader in, Writer out) %7B%0A        this(in, out, DEFAULT_BUFFER_SIZE);%0A    %7D%0A%0A    public ClosingPipe(Reader in, Writer out, int bufsize) %7B%0A        super(in, out, bufsize);%0A        closer = setupCloser(out);%0A    %7D%0A%0A    private Thread setupCloser(Closeable out) %7B%0A        Runnable pt = new OutCloser(out);%0A        Thread closer = new Thread(pt);%0A        closer.setName(String.format(%22ClosingPipeCloser %25d%22, this.hashCode()));%0A        closer.setDaemon(true);%0A        closer.start();%0A        return closer;%0A    %7D%0A%0A    private class OutCloser implements Runnable %7B%0A        private final Closeable out;%0A%0A        public OutCloser(Closeable out) %7B%0A            this.out = out;%0A        %7D%0A%0A        @Override%0A        public void run() %7B%0A            try %7B%0A                ClosingPipe.this.join();%0A                out.close();%0A            %7D%0A            catch (InterruptedException ie) %7B%0A                run(); // We're not giving up that easily.%0A            %7D%0A            catch (IOException ioe) %7B%0A                // The closable is somehow broken, leave it be.%0A            %7D%0A        %7D%0A    %7D%0A%7D%0A

Implement ClosingPipe.