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