public Status Iterate(Handler handler) {
		Slice input = new Slice(rep_.bytes);
		rep_.curr_pos = 0;
		if (input.size() < kHeader) {
			return Status.Corruption(new Slice(
					"malformed WriteBatch (too small)"), null);
		}

		// input.remove_prefix(kHeader);
		rep_.curr_pos += kHeader;
		Slice key, value;
		int found = 0;
		while (!rep_.STOP()) {
			found++;
			byte tag = rep_.get();// input.get(0);
			// input.remove_prefix(1);
			rep_.curr_pos += 1;
			switch (tag) {
			case ValueType.kTypeValue:
				try {
					key = coding.GetLengthPrefixedSlice(rep_);
					value = coding.GetLengthPrefixedSlice(rep_);
					handler.Put(key, value);
				} catch (Exception e) {
					e.printStackTrace();
					return Status.Corruption(new Slice("bad WriteBatch Put"),
							null);
				}
				break;
			case ValueType.kTypeDeletion:
				try {
					key = coding.GetLengthPrefixedSlice(rep_);

					handler.Delete(key);
				} catch (Exception e) {
					e.printStackTrace();
					return Status.Corruption(
							new Slice("bad WriteBatch Delete"), null);
				}
				break;
			default:
				return Status.Corruption(new Slice("unknown WriteBatch tag"),
						null);
			}
		}
		if (found != WriteBatchInternal.Count(this)) {
			return Status.Corruption(new Slice("WriteBatch has wrong count"),
					null);
		} else {
			return Status.OK();
		}
	}