本文整理了Java中org.apache.jena.atlas.json.JSON.toStringFlat()
方法的一些代码示例,展示了JSON.toStringFlat()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSON.toStringFlat()
方法的具体详情如下:
包路径:org.apache.jena.atlas.json.JSON
类名称:JSON
方法名:toStringFlat
[英]JsonValue to a string with no newlines
[中]将JsonValue转换为不带换行符的字符串
代码示例来源:origin: org.seaborne.rdf-delta/rdf-delta-client
private JsonValue rpcToValue(String opName, JsonObject arg) {
JsonObject argx = ( arg == null ) ? emptyObject : arg;
// [NET] Network point
return retry(()->DRPC.rpc(remoteServer + DeltaConst.EP_RPC, opName, argx),
()->true,
()->format("Retry : %s",opName),
()->format("Failed : %s %s",opName,JSON.toStringFlat(argx))
);
}
代码示例来源:origin: org.seaborne.rdf-delta/rdf-delta-client
Version version = Version.fromJson(sourceObj, F_VERSION, Version.UNSET);
if ( ! Version.isValid(version) ) {
LOG.warn("No version: "+JSON.toStringFlat(sourceObj));
dataState.datasource = Id.fromString(dsStr);
else {
LOG.error("No datasource: "+JSON.toStringFlat(sourceObj));
throw new DeltaException("No datasource: "+JSON.toStringFlat(sourceObj));
dataState.name = name;
else {
LOG.error("No datasource name: "+JSON.toStringFlat(sourceObj));
throw new DeltaException("No datasource name: "+JSON.toStringFlat(sourceObj));
代码示例来源:origin: org.seaborne.rdf-delta/rdf-delta-base
public static Version create(JsonValue version) {
Objects.requireNonNull(version, "version");
if ( version.isNumber() ) {
long ver = JSONX.getLong(version, -2);
if ( ver < -1 )
throw new DeltaException("Bad version number: '"+JSON.toStringFlat(version)+"'");
return create(ver);
}
if ( version.isString() ) {
try {
String s = version.getAsString().value();
long ver = Long.parseLong(s);
return create(ver);
} catch (NumberFormatException ex) {
throw new DeltaException("Bad format for version: '"+JSON.toStringFlat(version)+"'");
}
}
throw new DeltaException("Unrecognized JSON version: '"+JSON.toStringFlat(version)+"'");
}
代码示例来源:origin: org.seaborne.rdf-delta/rdf-delta-client
private JsonObject rpc(String opName, JsonObject arg) {
JsonValue r = rpcToValue(opName, arg);
if ( ! r.isObject() )
throw new DeltaException("Bad result to '"+opName+"': "+JSON.toStringFlat(r));
return r.getAsObject();
}
代码示例来源:origin: org.seaborne.rdf-delta/rdf-delta-base
public static Version fromJson(JsonObject obj, String field) {
long ver = JSONX.getLong(obj, field, -99) ;
if ( ver < -1 )
throw new DeltaException("Bad version number: '"+JSON.toStringFlat(obj.get(field))+"'");
return create(ver);
}
代码示例来源:origin: org.seaborne.rdf-delta/rdf-delta-client
private JsonObject rpcOnce(String opName, JsonObject arg) {
JsonValue r = rpcOnceToValue(opName, arg);
if ( ! r.isObject() )
throw new DeltaException("Bad result to '"+opName+"': "+JSON.toStringFlat(r));
return r.getAsObject();
}
代码示例来源:origin: org.seaborne.rdf-delta/rdf-delta-server-local
private void jsonSetState(JsonObject obj) {
try {
FmtLog.debug(LOG, "jsonToState %s",JSON.toStringFlat(obj));
long ver = obj.get(fVersion).getAsNumber().value().longValue();
if ( ver == version )
return ;
Id newCurrent = getIdOrNull(obj, fId);
Id newPrevious = getIdOrNull(obj, fPrevious);
newState(ver, newCurrent, newPrevious);
} catch (RuntimeException ex) {
FmtLog.error(this.getClass(), "Failed to load the patch log index state", ex);
}
}
代码示例来源:origin: org.seaborne.rdf-delta/rdf-delta-server-local
LOG.info(JSON.toStringFlat(obj));
try (OutputStream out = Files.newOutputStream(sourcePath.resolve(FileNames.DS_CONFIG))) {
JSON.write(out, obj);
内容来源于网络,如有侵权,请联系作者删除!