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


Java JSONUtil类代码示例

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


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

示例1: getRawObjectNames

import org.apache.hadoop.fs.swift.util.JSONUtil; //导入依赖的package包/类
private String[] getRawObjectNames() throws Exception {
  SwiftRestClient client;
  client = SwiftRestClient.getInstance(fs.getUri(), fs.getConf());
  SwiftObjectPath path = SwiftObjectPath.fromPath(fs.getUri(), new Path("/"));
  byte[] bytes = client.listDeepObjectsInDirectory(path, true, true);
  final CollectionType collectionType = JSONUtil.getJsonMapper().
    getTypeFactory().constructCollectionType(List.class,
                                             SwiftObjectFileStatus.class);
  final List<SwiftObjectFileStatus> fileStatusList =
    JSONUtil.toObject(new String(bytes), collectionType);
  final ArrayList<String> objects = new ArrayList();
  for (SwiftObjectFileStatus status : fileStatusList) {
    if (status.getName() != null) {
      objects.add(status.getName());
    } else if (status.getSubdir() != null) {
      objects.add(status.getSubdir());
    }
  }
  return objects.toArray(new String[objects.size()]);
}
 
开发者ID:openstack,项目名称:sahara-extra,代码行数:21,代码来源:TestSwiftFileSystemDirectories.java

示例2: getAuthenticationRequst

import org.apache.hadoop.fs.swift.util.JSONUtil; //导入依赖的package包/类
private StringRequestEntity getAuthenticationRequst(AuthenticationRequest authenticationRequest)
  throws IOException {
  final String data = JSONUtil.toJSON(new AuthenticationRequestWrapper(
          authenticationRequest));
  if (LOG.isDebugEnabled()) {
    LOG.debug("Authenticating with " + authenticationRequest);
  }
  return toJsonEntity(data);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:SwiftRestClient.java


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