// Path: diamond-utils/src/main/java/com/taobao/diamond/common/Constants.java
// public class Constants {
// 
//     public static final String DEFAULT_GROUP = "DEFAULT_GROUP";
//     
//     public static final String BASE_DIR = "config-data";
// 
//     public static final String DEFAULT_DOMAINNAME = "config.ixiaopu.com";
// 
//     public static final String DAILY_DOMAINNAME = "config.ixiaopu.com";
// 
//     public static final int DEFAULT_PORT = 54321;
// 
//     public static final String NULL = "";
// 
//     public static final String DATAID = "dataId";
// 
//     public static final String GROUP = "group";
// 
//     public static final String LAST_MODIFIED = "Last-Modified";
// 
//     public static final String ACCEPT_ENCODING = "Accept-Encoding";
// 
//     public static final String CONTENT_ENCODING = "Content-Encoding";
// 
//     public static final String PROBE_MODIFY_REQUEST = "Probe-Modify-Request";
// 
//     public static final String PROBE_MODIFY_RESPONSE = "Probe-Modify-Response";
// 
//     public static final String PROBE_MODIFY_RESPONSE_NEW = "Probe-Modify-Response-New";
// 
//     public static final String CONTENT_MD5 = "Content-MD5";
// 
//     public static final String IF_MODIFIED_SINCE = "If-Modified-Since";
// 
//     public static final String SPACING_INTERVAL = "client-spacing-interval";
//     
//     public static final String OPAQUE = "opaque";
// 
//     public static final int POLLING_INTERVAL_TIME = 15;// 秒
// 
//     public static final int ONCE_TIMEOUT = 5000;// 毫秒
// 
//     public static final int CONN_TIMEOUT = 5000;// 毫秒
// 
//     public static final int RECV_WAIT_TIMEOUT = ONCE_TIMEOUT * 5;// 毫秒
//     
//     public static final int CLIENT_CHANNEL_MAX_IDLE_TIME_SECONDS = 120;// 秒
//     
//     public static final int MAX_CONTENT_LENGTH = 1024 * 1024;// 1MB
// 
//     public static final String HTTP_URI_FILE = "/config.co";
//     
//     public static final String HTTP_PROTOCOL_PREFIX = "http://";
// 
//     public static final String CONFIG_HTTP_URI_FILE = "/ServerNodes";
// 
//     public static final String ENCODE = "UTF-8";
//     
//     public static final String LINE_SEPARATOR = Character.toString((char) 1);
// 
//     public static final String WORD_SEPARATOR = Character.toString((char) 2);
//     
//     public static final int SC_OK = 200;
//     public static final int SC_REQUEST_TIMEOUT = 408;
// 
//     /*
//      * 批量操作时, 单条数据的状态码
//      */
//     // 发生异常
//     public static final int BATCH_OP_ERROR = -1;
//     // 查询成功, 数据存在
//     public static final int BATCH_QUERY_EXISTS = 1;
//     // 查询成功, 数据不存在
//     public static final int BATCH_QUERY_NONEXISTS = 2;
//     // 新增成功
//     public static final int BATCH_ADD_SUCCESS = 3;
//     // 更新成功
//     public static final int BATCH_UPDATE_SUCCESS = 4;
// 
// }


import java.io.BufferedOutputStream;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import org.apache.commons.lang3.StringUtils;
import com.taobao.diamond.common.Constants;
            file.mkdir();
        }
    }


    public String getConfigInfomation(String dataId, String group) throws IOException {
        if (StringUtils.isBlank(dataId)) {
            return null;
        }
        if (StringUtils.isBlank(group)) {
            return null;
        }

        String path = dir + File.separator + group;
        final File dir = new File(path);
        if (!dir.exists()) {
            return null;
        }
        String filePath = path + File.separator + dataId;
        final File file = new File(filePath);
        if (!file.exists()) {
            return null;
        }
        FileInputStream in = null;
        StringBuilder sb = new StringBuilder(512);
        try {
            in = new FileInputStream(file);
            byte[] data = new byte[8192];
            int n = -1;
            while ((n = in.read(data)) != -1) {
// Path: diamond-utils/src/main/java/com/taobao/diamond/common/Constants.java
// public class Constants {
// 
//     public static final String DEFAULT_GROUP = "DEFAULT_GROUP";
//     
//     public static final String BASE_DIR = "config-data";
// 
//     public static final String DEFAULT_DOMAINNAME = "config.ixiaopu.com";
// 
//     public static final String DAILY_DOMAINNAME = "config.ixiaopu.com";
// 
//     public static final int DEFAULT_PORT = 54321;
// 
//     public static final String NULL = "";
// 
//     public static final String DATAID = "dataId";
// 
//     public static final String GROUP = "group";
// 
//     public static final String LAST_MODIFIED = "Last-Modified";
// 
//     public static final String ACCEPT_ENCODING = "Accept-Encoding";
// 
//     public static final String CONTENT_ENCODING = "Content-Encoding";
// 
//     public static final String PROBE_MODIFY_REQUEST = "Probe-Modify-Request";
// 
//     public static final String PROBE_MODIFY_RESPONSE = "Probe-Modify-Response";
// 
//     public static final String PROBE_MODIFY_RESPONSE_NEW = "Probe-Modify-Response-New";
// 
//     public static final String CONTENT_MD5 = "Content-MD5";
// 
//     public static final String IF_MODIFIED_SINCE = "If-Modified-Since";
// 
//     public static final String SPACING_INTERVAL = "client-spacing-interval";
//     
//     public static final String OPAQUE = "opaque";
// 
//     public static final int POLLING_INTERVAL_TIME = 15;// 秒
// 
//     public static final int ONCE_TIMEOUT = 5000;// 毫秒
// 
//     public static final int CONN_TIMEOUT = 5000;// 毫秒
// 
//     public static final int RECV_WAIT_TIMEOUT = ONCE_TIMEOUT * 5;// 毫秒
//     
//     public static final int CLIENT_CHANNEL_MAX_IDLE_TIME_SECONDS = 120;// 秒
//     
//     public static final int MAX_CONTENT_LENGTH = 1024 * 1024;// 1MB
// 
//     public static final String HTTP_URI_FILE = "/config.co";
//     
//     public static final String HTTP_PROTOCOL_PREFIX = "http://";
// 
//     public static final String CONFIG_HTTP_URI_FILE = "/ServerNodes";
// 
//     public static final String ENCODE = "UTF-8";
//     
//     public static final String LINE_SEPARATOR = Character.toString((char) 1);
// 
//     public static final String WORD_SEPARATOR = Character.toString((char) 2);
//     
//     public static final int SC_OK = 200;
//     public static final int SC_REQUEST_TIMEOUT = 408;
// 
//     /*
//      * 批量操作时, 单条数据的状态码
//      */
//     // 发生异常
//     public static final int BATCH_OP_ERROR = -1;
//     // 查询成功, 数据存在
//     public static final int BATCH_QUERY_EXISTS = 1;
//     // 查询成功, 数据不存在
//     public static final int BATCH_QUERY_NONEXISTS = 2;
//     // 新增成功
//     public static final int BATCH_ADD_SUCCESS = 3;
//     // 更新成功
//     public static final int BATCH_UPDATE_SUCCESS = 4;
// 
// }


// Path: diamond-client/src/main/java/com/taobao/diamond/client/processor/SnapshotConfigInfoProcessor.java
import java.io.BufferedOutputStream;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import org.apache.commons.lang3.StringUtils;
import com.taobao.diamond.common.Constants;

            file.mkdir();
        }
    }


    public String getConfigInfomation(String dataId, String group) throws IOException {
        if (StringUtils.isBlank(dataId)) {
            return null;
        }
        if (StringUtils.isBlank(group)) {
            return null;
        }

        String path = dir + File.separator + group;
        final File dir = new File(path);
        if (!dir.exists()) {
            return null;
        }
        String filePath = path + File.separator + dataId;
        final File file = new File(filePath);
        if (!file.exists()) {
            return null;
        }
        FileInputStream in = null;
        StringBuilder sb = new StringBuilder(512);
        try {
            in = new FileInputStream(file);
            byte[] data = new byte[8192];
            int n = -1;
            while ((n = in.read(data)) != -1) {
                sb.append(new String(data, 0, n, Constants.ENCODE));