org.apache.storm.utils.Utils.thriftDeserialize()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(3.7k)|赞(0)|评价(0)|浏览(108)

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

Utils.thriftDeserialize介绍

暂无

代码示例

代码示例来源:origin: apache/storm

public static <T> T thriftDeserialize(Class<T> c, byte[] b) {
    return Utils.thriftDeserialize(c, b);
  }
}

代码示例来源:origin: apache/storm

public static <T> T thriftDeserialize(Class<T> c, byte[] b) {
  try {
    return thriftDeserialize(c, b, 0, b.length);
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: apache/storm

private SettableBlobMeta getStoredBlobMeta(String key) throws KeyNotFoundException {
  InputStream in = null;
  try {
    BlobStoreFile pf = hbs.read(META_PREFIX + key);
    try {
      in = pf.getInputStream();
    } catch (FileNotFoundException fnf) {
      throw new WrappedKeyNotFoundException(key);
    }
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    byte[] buffer = new byte[2048];
    int len;
    while ((len = in.read(buffer)) > 0) {
      out.write(buffer, 0, len);
    }
    in.close();
    in = null;
    return Utils.thriftDeserialize(SettableBlobMeta.class, out.toByteArray());
  } catch (IOException e) {
    throw new RuntimeException(e);
  } finally {
    if (in != null) {
      try {
        in.close();
      } catch (IOException e) {
        //Ignored
      }
    }
  }
}

代码示例来源:origin: apache/storm

private SettableBlobMeta getStoredBlobMeta(String key) throws KeyNotFoundException {
  InputStream in = null;
  try {
    LocalFsBlobStoreFile pf = fbs.read(META_PREFIX + key);
    try {
      in = pf.getInputStream();
    } catch (FileNotFoundException fnf) {
      throw new WrappedKeyNotFoundException(key);
    }
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    byte[] buffer = new byte[2048];
    int len;
    while ((len = in.read(buffer)) > 0) {
      out.write(buffer, 0, len);
    }
    in.close();
    in = null;
    return Utils.thriftDeserialize(SettableBlobMeta.class, out.toByteArray());
  } catch (IOException e) {
    throw new RuntimeException(e);
  } finally {
    if (in != null) {
      try {
        in.close();
      } catch (IOException e) {
        //Ignored
      }
    }
  }
}

代码示例来源:origin: apache/storm

HBMessage m = (HBMessage) Utils.thriftDeserialize(HBMessage.class, serialized);

代码示例来源:origin: org.apache.storm/storm-core

public static <T> T thriftDeserialize(Class<T> c, byte[] b) {
    return Utils.thriftDeserialize(c,b);
  }
}

代码示例来源:origin: org.apache.storm/storm-core

public static <T> T thriftDeserialize(Class<T> c, byte[] b) {
  try {
    return Utils.thriftDeserialize(c, b, 0, b.length);
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: org.apache.storm/storm-hdfs

private SettableBlobMeta getStoredBlobMeta(String key) throws KeyNotFoundException {
  InputStream in = null;
  try {
    BlobStoreFile pf = hbs.read(META_PREFIX + key);
    try {
      in = pf.getInputStream();
    } catch (FileNotFoundException fnf) {
      throw new KeyNotFoundException(key);
    }
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    byte[] buffer = new byte[2048];
    int len;
    while ((len = in.read(buffer)) > 0) {
      out.write(buffer, 0, len);
    }
    in.close();
    in = null;
    return Utils.thriftDeserialize(SettableBlobMeta.class, out.toByteArray());
  } catch (IOException e) {
    throw new RuntimeException(e);
  } finally {
    if (in != null) {
      try {
        in.close();
      } catch (IOException e) {
        //Ignored
      }
    }
  }
}

代码示例来源:origin: org.apache.storm/storm-core

private SettableBlobMeta getStoredBlobMeta(String key) throws KeyNotFoundException {
  InputStream in = null;
  try {
    LocalFsBlobStoreFile pf = fbs.read(META_PREFIX+key);
    try {
      in = pf.getInputStream();
    } catch (FileNotFoundException fnf) {
      throw new KeyNotFoundException(key);
    }
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    byte [] buffer = new byte[2048];
    int len;
    while ((len = in.read(buffer)) > 0) {
      out.write(buffer, 0, len);
    }
    in.close();
    in = null;
    return Utils.thriftDeserialize(SettableBlobMeta.class, out.toByteArray());
  } catch (IOException e) {
    throw new RuntimeException(e);
  } finally {
    if (in != null) {
      try {
        in.close();
      } catch (IOException e) {
        //Ignored
      }
    }
  }
}

代码示例来源:origin: org.apache.storm/storm-core

HBMessage m = (HBMessage)Utils.thriftDeserialize(HBMessage.class, serialized);

相关文章

Utils类方法