当前位置: 首页>>代码示例>>Java>>正文


Java ZkMarshallingError类代码示例

本文整理汇总了Java中org.I0Itec.zkclient.exception.ZkMarshallingError的典型用法代码示例。如果您正苦于以下问题:Java ZkMarshallingError类的具体用法?Java ZkMarshallingError怎么用?Java ZkMarshallingError使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ZkMarshallingError类属于org.I0Itec.zkclient.exception包,在下文中一共展示了ZkMarshallingError类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import org.I0Itec.zkclient.exception.ZkMarshallingError; //导入依赖的package包/类
private void init() throws Exception {
        zkClient = new ZkClient(HOST.concat(":" + CLIENT_PORT), TIME_OUT_MILLISECOND);

        zkSerializer = new ZkSerializer() {
            /**
             * TODO{Benedict Jin}: kryo
             */
            @Override
            public byte[] serialize(Object data) throws ZkMarshallingError {
                return new byte[0];
            }

            @Override
            public Object deserialize(byte[] bytes) throws ZkMarshallingError {
                return null;
            }
        };
//        zkClient.setZkSerializer(zkSerializer);
    }
 
开发者ID:asdf2014,项目名称:yuzhouwan,代码行数:20,代码来源:ZkClientCRUD.java

示例2: deserialize

import org.I0Itec.zkclient.exception.ZkMarshallingError; //导入依赖的package包/类
public Object deserialize(final byte[] bytes) throws ZkMarshallingError {
    try {
        return new String(bytes, "utf-8");
    } catch (final UnsupportedEncodingException e) {
        throw new ZkMarshallingError(e);
    }
}
 
开发者ID:luoyaogui,项目名称:otter-G,代码行数:8,代码来源:StringSerializer.java

示例3: serialize

import org.I0Itec.zkclient.exception.ZkMarshallingError; //导入依赖的package包/类
public byte[] serialize(final Object data) throws ZkMarshallingError {
    try {
        return ((String) data).getBytes("utf-8");
    } catch (final UnsupportedEncodingException e) {
        throw new ZkMarshallingError(e);
    }
}
 
开发者ID:luoyaogui,项目名称:otter-G,代码行数:8,代码来源:StringSerializer.java

示例4: serialize

import org.I0Itec.zkclient.exception.ZkMarshallingError; //导入依赖的package包/类
public byte[] serialize(final Object data) throws ZkMarshallingError {
    try {
        if (data instanceof byte[]) {
            return (byte[]) data;
        } else {
            return ((String) data).getBytes("utf-8");
        }
    } catch (final UnsupportedEncodingException e) {
        throw new ZkMarshallingError(e);
    }
}
 
开发者ID:luoyaogui,项目名称:otter-G,代码行数:12,代码来源:ByteSerializer.java

示例5: serialize

import org.I0Itec.zkclient.exception.ZkMarshallingError; //导入依赖的package包/类
@Override
public byte[] serialize(Object data) throws ZkMarshallingError {
    if (!(data instanceof InputStream)) {
        return new byte[0];
    }

    try {
        return IOUtils.toByteArray((InputStream) data);
    } catch (IOException e) {
        if (logger.isErrorEnabled()) {
            logger.error(e.getMessage(), e);
        }
        return new byte[0];
    }
}
 
开发者ID:lodsve,项目名称:lodsve-framework,代码行数:16,代码来源:InputStreamSerializer.java

示例6: serialize

import org.I0Itec.zkclient.exception.ZkMarshallingError; //导入依赖的package包/类
@Override
public byte[] serialize(Object data) throws ZkMarshallingError {
	try {
		return data.toString().getBytes("UTF-8");
	} catch (UnsupportedEncodingException e) {
		throw new ZkMarshallingError(e);
	}
}
 
开发者ID:pulsarIO,项目名称:druid-kafka-ext,代码行数:9,代码来源:KafkaZKInfoTest.java

示例7: deserialize

import org.I0Itec.zkclient.exception.ZkMarshallingError; //导入依赖的package包/类
@Override
public Object deserialize(byte[] bytes) throws ZkMarshallingError {
	if (bytes == null)
	      return null;
	else
		try {
			return new String(bytes, "UTF-8");
		} catch (UnsupportedEncodingException e) {
			throw new ZkMarshallingError(e);
		}
}
 
开发者ID:pulsarIO,项目名称:druid-kafka-ext,代码行数:12,代码来源:KafkaZKInfoTest.java

示例8: deserialize

import org.I0Itec.zkclient.exception.ZkMarshallingError; //导入依赖的package包/类
@Override
public Object deserialize(byte[] bytes) throws ZkMarshallingError {
  if (isZKDirectBytes.get()) {
    return bytes;
  } else {
    return ZKStringSerializer.deserialize(bytes);
  }
}
 
开发者ID:shunfei,项目名称:DCMonitor,代码行数:9,代码来源:Resources.java

示例9: serialize

import org.I0Itec.zkclient.exception.ZkMarshallingError; //导入依赖的package包/类
@Override
public byte[] serialize(Object data) throws ZkMarshallingError {
    byte[] bytes = null;
    try {
        bytes = data.toString().getBytes("UTF-8");
    } catch (UnsupportedEncodingException e) {
        throw new ZkMarshallingError(e);
    }
    return bytes;
}
 
开发者ID:apache,项目名称:kylin,代码行数:11,代码来源:MockKafka.java

示例10: deserialize

import org.I0Itec.zkclient.exception.ZkMarshallingError; //导入依赖的package包/类
@Override
public Object deserialize(byte[] bytes) throws ZkMarshallingError {
    if (bytes == null)
        return null;
    else
        try {
            return new String(bytes, "UTF-8");
        } catch (UnsupportedEncodingException e) {
            throw new ZkMarshallingError(e);
        }
}
 
开发者ID:apache,项目名称:kylin,代码行数:12,代码来源:MockKafka.java

示例11: deserialize

import org.I0Itec.zkclient.exception.ZkMarshallingError; //导入依赖的package包/类
@Override
public Object deserialize(byte[] abyte0) throws ZkMarshallingError {
  try {
    return new String(abyte0, "utf-8");
  } catch (UnsupportedEncodingException e) {
    e.printStackTrace();
  }
  return null;
}
 
开发者ID:whyDK37,项目名称:pinenut,代码行数:10,代码来源:StringSerializer.java

示例12: serialize

import org.I0Itec.zkclient.exception.ZkMarshallingError; //导入依赖的package包/类
@Override
public byte[] serialize(Object obj) throws ZkMarshallingError {
  try {
    return ((String) obj).getBytes("utf-8");
  } catch (UnsupportedEncodingException e) {
    e.printStackTrace();
  }
  return null;
}
 
开发者ID:whyDK37,项目名称:pinenut,代码行数:10,代码来源:StringSerializer.java

示例13: deserialize

import org.I0Itec.zkclient.exception.ZkMarshallingError; //导入依赖的package包/类
@Override
public Object deserialize(byte[] abyte0) throws ZkMarshallingError {
	try {
		return new String(abyte0, "utf-8");
	} catch (UnsupportedEncodingException e) {
		e.printStackTrace();
	}
	return null;
}
 
开发者ID:whyDK37,项目名称:pinenut,代码行数:10,代码来源:StringSerializer.java

示例14: serialize

import org.I0Itec.zkclient.exception.ZkMarshallingError; //导入依赖的package包/类
@Override
public byte[] serialize(Object obj) throws ZkMarshallingError {
	 try {
		return ((String) obj).getBytes("utf-8");
	} catch (UnsupportedEncodingException e) {
		e.printStackTrace();
	}
	 return null;
}
 
开发者ID:whyDK37,项目名称:pinenut,代码行数:10,代码来源:StringSerializer.java

示例15: deserialize

import org.I0Itec.zkclient.exception.ZkMarshallingError; //导入依赖的package包/类
public Object deserialize(byte[] abyte0) throws ZkMarshallingError {
	try {
		return new String(abyte0, this.encoding);
	} catch (UnsupportedEncodingException e) {
		throw new RuntimeException(e);
	}

}
 
开发者ID:javachen,项目名称:learning-hadoop,代码行数:9,代码来源:ZkUtils.java


注:本文中的org.I0Itec.zkclient.exception.ZkMarshallingError类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。