@Override
	public void run() {
		while (isWriter) {
			int i;
			int j;
			synchronized (this) {
				if (buffIndex == writeIndex) {
					try {
						wait();
					} catch (InterruptedException interruptedexception) {
					}
				}
				if (!isWriter) {
					return;
				}
				j = writeIndex;
				if (buffIndex >= writeIndex) {
					i = buffIndex - writeIndex;
				} else {
					i = 5000 - writeIndex;
				}
			}
			if (i > 0) {
				try {
					outputStream.write(buffer, j, i);
				} catch (IOException ioexception) {
					hasIOError = true;
				}
				writeIndex = (writeIndex + i) % 5000;
				try {
					if (buffIndex == writeIndex) {
						outputStream.flush();
					}
				} catch (IOException ioexception) {
					hasIOError = true;
				}
			}
		}
	}