gpt4 book ai didi

org.I0Itec.zkclient.exception.ZkMarshallingError.()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-14 18:50:49 28 4
gpt4 key购买 nike

本文整理了Java中org.I0Itec.zkclient.exception.ZkMarshallingError.<init>()方法的一些代码示例,展示了ZkMarshallingError.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZkMarshallingError.<init>()方法的具体详情如下:
包路径:org.I0Itec.zkclient.exception.ZkMarshallingError
类名称:ZkMarshallingError
方法名:<init>

ZkMarshallingError.<init>介绍

暂无

代码示例

代码示例来源:origin: alibaba/canal

public Object deserialize(final byte[] bytes) throws ZkMarshallingError {
  try {
    return new String(bytes, "utf-8");
  } catch (final UnsupportedEncodingException e) {
    throw new ZkMarshallingError(e);
  }
}

代码示例来源:origin: alibaba/canal

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);
  }
}

代码示例来源:origin: alibaba/canal

public byte[] serialize(final Object data) throws ZkMarshallingError {
  try {
    return ((String) data).getBytes("utf-8");
  } catch (final UnsupportedEncodingException e) {
    throw new ZkMarshallingError(e);
  }
}

代码示例来源:origin: weibocom/motan

@Override
  public byte[] serialize(Object obj) throws ZkMarshallingError {
    try {
      return obj.toString().getBytes("UTF-8");
    } catch (UnsupportedEncodingException e) {
      throw new ZkMarshallingError(e);
    }
  }
}

代码示例来源:origin: killme2008/Metamorphosis

@Override
public Object deserialize(final byte[] bytes) throws ZkMarshallingError {
  try {
    return new String(bytes, "utf-8");
  }
  catch (final UnsupportedEncodingException e) {
    throw new ZkMarshallingError(e);
  }
}

代码示例来源:origin: killme2008/Metamorphosis

@Override
public byte[] serialize(final Object data) throws ZkMarshallingError {
  try {
    return ((String) data).getBytes("utf-8");
  }
  catch (final UnsupportedEncodingException e) {
    throw new ZkMarshallingError(e);
  }
}

代码示例来源:origin: weibocom/motan

@Override
public Object deserialize(byte[] bytes) throws ZkMarshallingError {
  if (bytes == null){
    return null;
  }
  try {
    if (bytes.length > 1 && ByteUtil.bytes2short(bytes, 0) == ObjectStreamConstants.STREAM_MAGIC) {
      return super.deserialize(bytes);
    }
    return new String(bytes, "UTF-8");
  } catch (UnsupportedEncodingException e) {
    throw new ZkMarshallingError(e);
  }
}

代码示例来源:origin: amient/kafka-metrics

@Override
public byte[] serialize(Object o) throws ZkMarshallingError {
  throw new ZkMarshallingError("This is a read-only zkClient");
}

代码示例来源:origin: com.alibaba.otter/shared.common

public byte[] serialize(final Object data) throws ZkMarshallingError {
  try {
    return ((String) data).getBytes("utf-8");
  } catch (final UnsupportedEncodingException e) {
    throw new ZkMarshallingError(e);
  }
}

代码示例来源:origin: com.alibaba.otter/shared.common

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);
  }
}

代码示例来源:origin: com.alibaba.otter/shared.common

public Object deserialize(final byte[] bytes) throws ZkMarshallingError {
  try {
    return new String(bytes, "utf-8");
  } catch (final UnsupportedEncodingException e) {
    throw new ZkMarshallingError(e);
  }
}

代码示例来源:origin: amient/kafka-metrics

@Override
  public Object deserialize(byte[] bytes) throws ZkMarshallingError {
    try {
      return mapper.readTree(bytes);
    } catch (IOException e) {
      throw new ZkMarshallingError(e);
    }
  }
});

代码示例来源:origin: variflight/feeyo-redisproxy

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);
  }
}

代码示例来源:origin: com.github.sgroschupf/zkclient

@Override
public Object deserialize(byte[] bytes) throws ZkMarshallingError {
  try {
    ObjectInputStream inputStream = new ObjectInputStream(new ByteArrayInputStream(bytes));
    Object object = inputStream.readObject();
    return object;
  } catch (ClassNotFoundException e) {
    throw new ZkMarshallingError("Unable to find object class.", e);
  } catch (IOException e) {
    throw new ZkMarshallingError(e);
  }
}

代码示例来源:origin: com.weibo/motan-registry-zookeeper

@Override
  public byte[] serialize(Object obj) throws ZkMarshallingError {
    try {
      return obj.toString().getBytes("UTF-8");
    } catch (UnsupportedEncodingException e) {
      throw new ZkMarshallingError(e);
    }
  }
}

代码示例来源:origin: com.101tec/zkclient

@Override
public byte[] serialize(Object serializable) throws ZkMarshallingError {
  try {
    ByteArrayOutputStream byteArrayOS = new ByteArrayOutputStream();
    ObjectOutputStream stream = new ObjectOutputStream(byteArrayOS);
    stream.writeObject(serializable);
    stream.close();
    return byteArrayOS.toByteArray();
  } catch (IOException e) {
    throw new ZkMarshallingError(e);
  }
}

代码示例来源:origin: com.github.sgroschupf/zkclient

@Override
public byte[] serialize(Object serializable) throws ZkMarshallingError {
  try {
    ByteArrayOutputStream byteArrayOS = new ByteArrayOutputStream();
    ObjectOutputStream stream = new ObjectOutputStream(byteArrayOS);
    stream.writeObject(serializable);
    stream.close();
    return byteArrayOS.toByteArray();
  } catch (IOException e) {
    throw new ZkMarshallingError(e);
  }
}

代码示例来源:origin: com.101tec/zkclient

@Override
public Object deserialize(byte[] bytes) throws ZkMarshallingError {
  try {
    ObjectInputStream inputStream = new TcclAwareObjectIputStream(new ByteArrayInputStream(bytes));
    Object object = inputStream.readObject();
    return object;
  } catch (ClassNotFoundException e) {
    throw new ZkMarshallingError("Unable to find object class.", e);
  } catch (IOException e) {
    throw new ZkMarshallingError(e);
  }
}

代码示例来源:origin: javachen/learning-hadoop

public byte[] serialize(Object obj) throws ZkMarshallingError {
    if (obj == null) {
      return null;
    }
    if (!(obj instanceof String)) {
      throw new ZkMarshallingError(
          "The input obj must be an instance of String.");
    }
    try {
      return ((String) obj).getBytes(this.encoding);
    } catch (UnsupportedEncodingException e) {
      throw new RuntimeException(e);
    }
  }
}

代码示例来源:origin: com.weibo/motan-registry-zookeeper

@Override
public Object deserialize(byte[] bytes) throws ZkMarshallingError {
  if (bytes == null){
    return null;
  }
  try {
    if (bytes.length > 1 && ByteUtil.bytes2short(bytes, 0) == ObjectStreamConstants.STREAM_MAGIC) {
      return super.deserialize(bytes);
    }
    return new String(bytes, "UTF-8");
  } catch (UnsupportedEncodingException e) {
    throw new ZkMarshallingError(e);
  }
}

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com