// Path: Redis-Synyed-common/src/main/java/com/wmz7year/synyed/constant/RedisRDBConstant.java
// public static final byte REDIS_ENCODING_ZIPLIST = 5; /*
// 
// Path: Redis-Synyed-common/src/main/java/com/wmz7year/synyed/constant/RedisRDBConstant.java
// public static final byte REDIS_HASH = 4;
// 
// Path: Redis-Synyed-util/src/main/java/com/wmz7year/synyed/util/NumberUtil.java
// public static int byte2Int(byte[] buffer) {
// 	if (buffer == null) {
// 		throw new NullPointerException();
// 	}
// 	if (buffer.length != 4) {
// 		throw new IllegalArgumentException(
// 				"Error buffer length can not cover bytes to int:" + Arrays.toString(buffer));
// 	}
// 	return (((buffer[3]) << 24) | ((buffer[2] & 0xff) << 16) | ((buffer[1] & 0xff) << 8) | ((buffer[0] & 0xff)));
// }
// 
// Path: Redis-Synyed-common/src/main/java/com/wmz7year/synyed/exception/RedisRDBException.java
// public class RedisRDBException extends Exception {
// 	private static final long serialVersionUID = -8089839086790389424L;
// 	private Throwable nestedThrowable = null;
// 
// 	public RedisRDBException() {
// 		super();
// 	}
// 
// 	public RedisRDBException(String msg) {
// 		super(msg);
// 	}
// 
// 	public RedisRDBException(Throwable nestedThrowable) {
// 		super(nestedThrowable);
// 		this.nestedThrowable = nestedThrowable;
// 	}
// 
// 	public RedisRDBException(String msg, Throwable nestedThrowable) {
// 		super(msg, nestedThrowable);
// 		this.nestedThrowable = nestedThrowable;
// 	}
// 
// 	/*
// 	 * @see java.lang.Throwable#printStackTrace()
// 	 */
// 	@Override
// 	public void printStackTrace() {
// 		super.printStackTrace();
// 		if (nestedThrowable != null) {
// 			nestedThrowable.printStackTrace();
// 		}
// 	}
// 
// 	/*
// 	 * @see java.lang.Throwable#printStackTrace(java.io.PrintStream)
// 	 */
// 	@Override
// 	public void printStackTrace(PrintStream ps) {
// 		super.printStackTrace(ps);
// 		if (nestedThrowable != null) {
// 			nestedThrowable.printStackTrace(ps);
// 		}
// 	}
// 
// 	/*
// 	 * @see java.lang.Throwable#printStackTrace(java.io.PrintWriter)
// 	 */
// 	@Override
// 	public void printStackTrace(PrintWriter pw) {
// 		super.printStackTrace(pw);
// 		if (nestedThrowable != null) {
// 			nestedThrowable.printStackTrace(pw);
// 		}
// 	}
// }


import static com.wmz7year.synyed.constant.RedisRDBConstant.REDIS_ENCODING_ZIPLIST;
import static com.wmz7year.synyed.constant.RedisRDBConstant.REDIS_HASH;
import static com.wmz7year.synyed.util.NumberUtil.byte2Int;
import java.io.ByteArrayInputStream;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import com.wmz7year.synyed.exception.RedisRDBException;
package com.wmz7year.synyed.parser.entry;




/**
 * redis hash zipmap类型数据结构对象
 * 
 * @Title: RedisHashZipMap.java
 * @Package com.wmz7year.synyed.parser.entry
 * @author jiangwei (ydswcy513@gmail.com)
 * @date 2015年12月18日 上午11:30:08
 * @version V1.0
 */
public class RedisHashZipMap extends RedisObject {
	/**
	 * 空格占位符
	 */
	private static final byte FREE = 0x00;

	/**
	 * hash zipmap数据
	 */
	private byte[] buffer;

	private ByteArrayInputStream bis = null;

	/**
	 * zip map中的元素长度
	 */
	private int zmLen = 0;
	/**
	 * 当前所包含的元素数量
	 */
	private int entryCount = 0;

	/**
	 * 解析出的元素列表
	 */
	private Map<String, String> elements = new HashMap<String, String>();

// Path: Redis-Synyed-common/src/main/java/com/wmz7year/synyed/constant/RedisRDBConstant.java
// public static final byte REDIS_ENCODING_ZIPLIST = 5; /*
// 
// Path: Redis-Synyed-common/src/main/java/com/wmz7year/synyed/constant/RedisRDBConstant.java
// public static final byte REDIS_HASH = 4;
// 
// Path: Redis-Synyed-util/src/main/java/com/wmz7year/synyed/util/NumberUtil.java
// public static int byte2Int(byte[] buffer) {
// 	if (buffer == null) {
// 		throw new NullPointerException();
// 	}
// 	if (buffer.length != 4) {
// 		throw new IllegalArgumentException(
// 				"Error buffer length can not cover bytes to int:" + Arrays.toString(buffer));
// 	}
// 	return (((buffer[3]) << 24) | ((buffer[2] & 0xff) << 16) | ((buffer[1] & 0xff) << 8) | ((buffer[0] & 0xff)));
// }
// 
// Path: Redis-Synyed-common/src/main/java/com/wmz7year/synyed/exception/RedisRDBException.java
// public class RedisRDBException extends Exception {
// 	private static final long serialVersionUID = -8089839086790389424L;
// 	private Throwable nestedThrowable = null;
// 
// 	public RedisRDBException() {
// 		super();
// 	}
// 
// 	public RedisRDBException(String msg) {
// 		super(msg);
// 	}
// 
// 	public RedisRDBException(Throwable nestedThrowable) {
// 		super(nestedThrowable);
// 		this.nestedThrowable = nestedThrowable;
// 	}
// 
// 	public RedisRDBException(String msg, Throwable nestedThrowable) {
// 		super(msg, nestedThrowable);
// 		this.nestedThrowable = nestedThrowable;
// 	}
// 
// 	/*
// 	 * @see java.lang.Throwable#printStackTrace()
// 	 */
// 	@Override
// 	public void printStackTrace() {
// 		super.printStackTrace();
// 		if (nestedThrowable != null) {
// 			nestedThrowable.printStackTrace();
// 		}
// 	}
// 
// 	/*
// 	 * @see java.lang.Throwable#printStackTrace(java.io.PrintStream)
// 	 */
// 	@Override
// 	public void printStackTrace(PrintStream ps) {
// 		super.printStackTrace(ps);
// 		if (nestedThrowable != null) {
// 			nestedThrowable.printStackTrace(ps);
// 		}
// 	}
// 
// 	/*
// 	 * @see java.lang.Throwable#printStackTrace(java.io.PrintWriter)
// 	 */
// 	@Override
// 	public void printStackTrace(PrintWriter pw) {
// 		super.printStackTrace(pw);
// 		if (nestedThrowable != null) {
// 			nestedThrowable.printStackTrace(pw);
// 		}
// 	}
// }


// Path: Redis-Synyed-common/src/main/java/com/wmz7year/synyed/parser/entry/RedisHashZipMap.java
import static com.wmz7year.synyed.constant.RedisRDBConstant.REDIS_ENCODING_ZIPLIST;
import static com.wmz7year.synyed.constant.RedisRDBConstant.REDIS_HASH;
import static com.wmz7year.synyed.util.NumberUtil.byte2Int;
import java.io.ByteArrayInputStream;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import com.wmz7year.synyed.exception.RedisRDBException;

package com.wmz7year.synyed.parser.entry;




/**
 * redis hash zipmap类型数据结构对象
 * 
 * @Title: RedisHashZipMap.java
 * @Package com.wmz7year.synyed.parser.entry
 * @author jiangwei (ydswcy513@gmail.com)
 * @date 2015年12月18日 上午11:30:08
 * @version V1.0
 */
public class RedisHashZipMap extends RedisObject {
	/**
	 * 空格占位符
	 */
	private static final byte FREE = 0x00;

	/**
	 * hash zipmap数据
	 */
	private byte[] buffer;

	private ByteArrayInputStream bis = null;

	/**
	 * zip map中的元素长度
	 */
	private int zmLen = 0;
	/**
	 * 当前所包含的元素数量
	 */
	private int entryCount = 0;

	/**
	 * 解析出的元素列表
	 */
	private Map<String, String> elements = new HashMap<String, String>();

	public RedisHashZipMap(byte[] buffer) throws RedisRDBException {