org.apache.eagle.jpm.util.Utils.closeInputStream()方法的使用及代码示例

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

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

Utils.closeInputStream介绍

暂无

代码示例

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

public static List<UserEmailEntity> getUserMail(Config config, String siteId, String userId) {
  List<UserEmailEntity> result = new ArrayList<>();
  String url = "http://"
    + config.getString(Constants.HOST_PATH)
    + ":"
    + config.getInt(Constants.PORT_PATH)
    + config.getString(Constants.CONTEXT_PATH)
    + Constants.ANALYZER_PATH
    + Constants.USER_META_ROOT_PATH
    + "/"
    + siteId
    + "/"
    + URLEncoder.encode(userId);
  InputStream is = null;
  try {
    is = InputStreamUtils.getInputStream(url, null, org.apache.eagle.jpm.util.Constants.CompressionType.NONE);
    LOG.info("get user meta from {}", url);
    result = ((RESTResponse<List<UserEmailEntity>>) OBJ_MAPPER.readValue(is,
      new TypeReference<RESTResponse<List<UserEmailEntity>>>() {
      })).getData();
  } catch (Exception e) {
    LOG.warn("failed to get user meta from {}", url, e);
  } finally {
    org.apache.eagle.jpm.util.Utils.closeInputStream(is);
  }
  return result;
}

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

public static List<JobMetaEntity> getJobMeta(Config config, String siteId, String jobDefId) {
  List<JobMetaEntity> result = new ArrayList<>();
  String url = "http://"
    + config.getString(Constants.HOST_PATH)
    + ":"
    + config.getInt(Constants.PORT_PATH)
    + config.getString(Constants.CONTEXT_PATH)
    + Constants.ANALYZER_PATH
    + Constants.JOB_META_ROOT_PATH
    + "/"
    + siteId
    + "/"
    + URLEncoder.encode(jobDefId);
  InputStream is = null;
  try {
    is = InputStreamUtils.getInputStream(url, null, org.apache.eagle.jpm.util.Constants.CompressionType.NONE);
    LOG.info("get job meta from {}", url);
    result = ((RESTResponse<List<JobMetaEntity>>) OBJ_MAPPER.readValue(is,
      new TypeReference<RESTResponse<List<JobMetaEntity>>>() {
      })).getData();
  } catch (Exception e) {
    LOG.warn("failed to get job meta from {}", url, e);
  } finally {
    org.apache.eagle.jpm.util.Utils.closeInputStream(is);
  }
  return result;
}

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

return false;
} finally {
  Utils.closeInputStream(is);

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

return false;
} finally {
  Utils.closeInputStream(is);

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

continue;
} finally {
  Utils.closeInputStream(is);

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

return false;
} finally {
  Utils.closeInputStream(is);

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

return false;
} finally {
  Utils.closeInputStream(is);

相关文章