本文整理汇总了Java中org.noggit.JSONWriter.writeNameSeparator方法的典型用法代码示例。如果您正苦于以下问题:Java JSONWriter.writeNameSeparator方法的具体用法?Java JSONWriter.writeNameSeparator怎么用?Java JSONWriter.writeNameSeparator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.noggit.JSONWriter
的用法示例。
在下文中一共展示了JSONWriter.writeNameSeparator方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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();
}
示例4: writeKeyValue
import org.noggit.JSONWriter; //导入方法依赖的package包/类
public void writeKeyValue(JSONWriter json, String k, Object v, boolean isFirst) {
if (!isFirst) {
json.writeValueSeparator();
}
if (indent) {
json.indent();
}
json.writeString(k);
json.writeNameSeparator();
json.write(v);
}
示例5: streamToJson
import org.noggit.JSONWriter; //导入方法依赖的package包/类
@Override
public void streamToJson(JSONWriter jsonWriter) {
jsonWriter.write(this.getName());
jsonWriter.writeNameSeparator();
jsonWriter.writeString(this.function);
}
示例6: writeBooleanField
import org.noggit.JSONWriter; //导入方法依赖的package包/类
protected void writeBooleanField(JSONWriter jsonWriter, String fieldName, boolean value) {
jsonWriter.write(fieldName);
jsonWriter.writeNameSeparator();
jsonWriter.write(value);
}
示例7: writeNumberField
import org.noggit.JSONWriter; //导入方法依赖的package包/类
protected void writeNumberField(JSONWriter jsonWriter, String fieldName, Number value) {
jsonWriter.write(fieldName);
jsonWriter.writeNameSeparator();
jsonWriter.write(value);
}
示例8: writeStringField
import org.noggit.JSONWriter; //导入方法依赖的package包/类
protected void writeStringField(JSONWriter jsonWriter, String fieldName, String value) {
jsonWriter.write(fieldName);
jsonWriter.writeNameSeparator();
jsonWriter.write(value);
}
示例9: 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());
}
示例10: writeField
import org.noggit.JSONWriter; //导入方法依赖的package包/类
private void writeField(String key, Object value, JSONWriter writer) {
writer.writeString(key);
writer.writeNameSeparator();
writer.write(value);
}