本文整理汇总了Java中org.noggit.JSONWriter.endObject方法的典型用法代码示例。如果您正苦于以下问题:Java JSONWriter.endObject方法的具体用法?Java JSONWriter.endObject怎么用?Java JSONWriter.endObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.noggit.JSONWriter
的用法示例。
在下文中一共展示了JSONWriter.endObject方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeError
import org.noggit.JSONWriter; //导入方法依赖的package包/类
void writeError(int code, String msg) throws IOException {
response.setStatus(code);
CharArr chars = new CharArr();
JSONWriter w = new JSONWriter(chars, 2);
w.startObject();
w.indent();
w.writeString("status");
w.writeNameSeparator();
w.write(code);
w.writeValueSeparator();
w.indent();
w.writeString("error");
w.writeNameSeparator();
w.writeString(msg);
w.endObject();
out.write(chars.toString());
}
示例2: streamToJson
import org.noggit.JSONWriter; //导入方法依赖的package包/类
@Override
public void streamToJson(JSONWriter jsonWriter) {
jsonWriter.write(this.name);
jsonWriter.writeNameSeparator();
jsonWriter.startObject();
jsonWriter.indent();
this.writeStringField(jsonWriter, FIELD_TYPE, this.type);
this.writeValueSeparator(jsonWriter);
this.writeFacetConfiguration(jsonWriter);
this.writeSubFacets(jsonWriter);
jsonWriter.indent();
jsonWriter.endObject();
}
示例3: toJsonString
import org.noggit.JSONWriter; //导入方法依赖的package包/类
@Override
public String toJsonString() {
CharArr charArr = new CharArr();
JSONWriter jsonWriter = new JSONWriter(charArr, 2);
jsonWriter.startObject();
jsonWriter.indent();
this.streamToJson(jsonWriter);
jsonWriter.indent();
jsonWriter.endObject();
return charArr.toString();
}
示例4: writeSubFacets
import org.noggit.JSONWriter; //导入方法依赖的package包/类
protected void writeSubFacets(JSONWriter jsonWriter) {
if (this.subFacets.isEmpty()) {
return;
}
this.writeValueSeparator(jsonWriter);
jsonWriter.write(FIELD_FACET);
jsonWriter.writeNameSeparator();
jsonWriter.startObject();
jsonWriter.indent();
this.writeFacets(jsonWriter, this.subFacets);
jsonWriter.indent();
jsonWriter.endObject();
}
示例5: log
import org.noggit.JSONWriter; //导入方法依赖的package包/类
public void log(
String userName,
String impersonator,
String ipAddress,
String operation,
String operationParams,
long eventTime,
int allowed,
String collectionName) {
if (!isLogEnabled()) {
return;
}
CharArr chars = new CharArr(512);
JSONWriter writer = new JSONWriter(chars, -1);
writer.startObject();
writeField("solrVersion", SOLR_VERSION, writer);
writer.writeValueSeparator();
writeField("eventTime", eventTime, writer);
writer.writeValueSeparator();
writeField("allowed", allowed, writer);
writer.writeValueSeparator();
writeField("collectionName", collectionName, writer);
writer.writeValueSeparator();
writeField("operation", operation, writer);
writer.writeValueSeparator();
writeField("operationParams", operationParams, writer);
writer.writeValueSeparator();
writeField("ipAddress", ipAddress, writer);
writer.writeValueSeparator();
writeField("username", userName, writer);
writer.writeValueSeparator();
writeField("impersonator", impersonator, writer);
writer.endObject();
logger.info("{}", chars);
}
示例6: print
import org.noggit.JSONWriter; //导入方法依赖的package包/类
void print(String path) throws IOException {
if (zkClient == null) {
return;
}
// normalize path
if (path == null) {
path = "/";
} else {
path = path.trim();
if (path.length() == 0) {
path = "/";
}
}
if (path.endsWith("/") && path.length() > 1) {
path = path.substring(0, path.length() - 1);
}
int idx = path.lastIndexOf('/');
String parent = idx >= 0 ? path.substring(0, idx) : path;
if (parent.length() == 0) {
parent = "/";
}
CharArr chars = new CharArr();
JSONWriter json = new JSONWriter(chars, 2);
json.startObject();
if (detail) {
if (!printZnode(json, path)) {
return;
}
json.writeValueSeparator();
}
json.writeString("tree");
json.writeNameSeparator();
json.startArray();
if (!printTree(json, path)) {
return; // there was an error
}
json.endArray();
json.endObject();
out.write(chars.toString());
}