package com.hypirion.io;

import java.io.InputStream;
import java.io.IOException;

public class RevivableInputStream extends InputStream {
    protected InputStream in;

    public RevivableInputStream(InputStream in) {
        this.in = in;
    }

    public int available() throws IOException {
        return in.available();
    }

    public void close() throws IOException {
        in.close();
    }

    public boolean markSupported() {
        return in.markSupported();
    }

    public int read() throws IOException {
        return in.read();
    }

    public int read(byte[] b) throws IOException {
        return in.read(b);
    }

    public int read(byte[] b, int off, int len) throws IOException {
        return in.read(b, off, len);
    }

    public void reset() throws IOException {
        in.reset();
    }

    public long skip(long n) throws IOException {
        return in.skip(n);
    }
}

@@ -132,16 +132,46 @@
 tream %7B%0A
+    protected boolean killed;%0A
     prot
@@ -265,16 +265,40 @@
 n = in;%0A
+        killed = false;%0A
     %7D%0A%0A 
@@ -568,32 +568,92 @@
 s IOException %7B%0A
+        if (killed)%0A            return -1;%0A        else%0A    
         return i
@@ -712,32 +712,92 @@
 s IOException %7B%0A
+        if (killed)%0A            return -1;%0A        else%0A    
         return i
@@ -875,32 +875,92 @@
 s IOException %7B%0A
+        if (killed)%0A            return -1;%0A        else%0A    
         return i
@@ -1141,11 +1141,127 @@
 );%0A    %7D
+%0A%0A    public void kill() %7B%0A        killed = true;%0A    %7D%0A%0A    public void ressurect() %7B%0A        killed = false;%0A    %7D
 %0A%7D%0A

Implement thread-unsafe killing.