用户:洞穴夜莺/EInputStream

这个用户就是洞穴夜莺

eee

当你开始eee的时候,别人也在回复你eee。本条目经过e 道 阳 光认可,适合热衷作死eee的用户阅读。在eee前,请您eee

  • 务必遵守论坛规章制度,这种行为可能招致您被MCBBS管理人员警告乃至封禁!
  • 切勿eee过度,过度eee是违规行为,且可能会招致别人eee乃至91.35W个e
  • 不信e不传e
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

/**
 * You can read nothing but infinite 'e' from an EInputStream
 * @author CaveNightingale
 */
public class EInputStream extends InputStream {
    private static final byte[] BUFFER = new byte[8192];
    static {
        for(int i = 0; i < BUFFER.length; i++)
            BUFFER[i] = (byte)'e';
    }

    @Override
    public int read() {
        return 'e';
    }

    @Override
    public int read(byte[] b) {
        for(int i = 0; i < b.length; i++)
            b[i] = (byte)'e';
        return b.length;
    }

    @Override
    public byte[] readAllBytes() {
        throw new OutOfMemoryError("Endless");
    }

    @Override
    public int read(byte[] b, int off, int len) {
        for(int i = off; i < len + off; i++)
            b[i] = (byte)'e';
        return len;
    }

    @Override
    public byte[] readNBytes(int len) {
        byte[] rval = new byte[len];
        read(rval);
        return rval;
    }

    @Override
    public int readNBytes(byte[] b, int off, int len) {
        return read(b, off, len);
    }

    @Override
    public long skip(long n) {
        return n;
    }

    @Override
    public long transferTo(OutputStream out) throws IOException {
        while(true)
            out.write(BUFFER);
    }
}