@Override
	protected int readByte() throws IOException {
		if (inflater == null) {
			return -1;
		}
		try {
			while (inflater.inflate(buffer, 0, 1) == 0) {
				if (inflater.finished()) {
					inflater.end();
					inflater = null;
					return -1;
				} else if (inflater.needsDictionary()) {
					inflater.end();
					inflater = null;
					throw new IOException(
							"zlib preset dictionary not supported");
				} else if (inflater.needsInput()) {
					int toRead = compressedRemaining < buffer.length ? compressedRemaining
							: buffer.length;
					toRead = reader.readBlock(buffer, 0, toRead);
					if (toRead <= 0) {
						throw new EOFException("end of compressed data");
					}
					compressedRemaining -= toRead;
					inflater.setInput(buffer, 0, toRead);
				} else {
					inflater.end();
					inflater = null;
					throw new IOException("Inflater error");
				}
			}
			return buffer[0] & 0xff;
		} catch (DataFormatException e) {
			throw new IOException("inflate error: " + e.getMessage());
		}
	}