本文整理汇总了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()]);
}
示例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);
}