org.apache.jena.atlas.json.JSON.toStringFlat()方法的使用及代码示例

x33g5p2x  于2022-01-22 转载在 其他  
字(3.5k)|赞(0)|评价(0)|浏览(184)

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

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);

相关文章