本文整理汇总了Java中org.noggit.CharArr.toString方法的典型用法代码示例。如果您正苦于以下问题:Java CharArr.toString方法的具体用法?Java CharArr.toString怎么用?Java CharArr.toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.noggit.CharArr
的用法示例。
在下文中一共展示了CharArr.toString方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: printClusterStateInfo
import org.noggit.CharArr; //导入方法依赖的package包/类
protected static String printClusterStateInfo(String collection) throws Exception {
cloudSolrClient.getZkStateReader().updateClusterState();
String cs = null;
ClusterState clusterState = cloudSolrClient.getZkStateReader().getClusterState();
if (collection != null) {
cs = clusterState.getCollection(collection).toString();
} else {
Map<String, DocCollection> map = new HashMap<String, DocCollection>();
for (String coll : clusterState.getCollections())
map.put(coll, clusterState.getCollection(coll));
CharArr out = new CharArr();
new JSONWriter(out, 2).write(map);
cs = out.toString();
}
return cs;
}
示例2: jsonAdd
import org.noggit.CharArr; //导入方法依赖的package包/类
/** Creates a JSON add command from a SolrInputDocument list. Doesn't currently handle boosts. */
public static String jsonAdd(SolrInputDocument... docs) {
CharArr out = new CharArr();
try {
out.append('[');
boolean firstField = true;
for (SolrInputDocument doc : docs) {
if (firstField) firstField=false;
else out.append(',');
out.append(json(doc));
}
out.append(']');
} catch (IOException e) {
// should never happen
}
return out.toString();
}
示例3: jsonDelId
import org.noggit.CharArr; //导入方法依赖的package包/类
/** Creates a JSON delete command from an id list */
public static String jsonDelId(Object... ids) {
CharArr out = new CharArr();
try {
out.append('{');
boolean first = true;
for (Object id : ids) {
if (first) first=false;
else out.append(',');
out.append("\"delete\":{\"id\":");
out.append(JSONUtil.toJSON(id));
out.append('}');
}
out.append('}');
} catch (IOException e) {
// should never happen
}
return out.toString();
}
示例4: jsonDelQ
import org.noggit.CharArr; //导入方法依赖的package包/类
/** Creates a JSON deleteByQuery command */
public static String jsonDelQ(String... queries) {
CharArr out = new CharArr();
try {
out.append('{');
boolean first = true;
for (Object q : queries) {
if (first) first=false;
else out.append(',');
out.append("\"delete\":{\"query\":");
out.append(JSONUtil.toJSON(q));
out.append('}');
}
out.append('}');
} catch (IOException e) {
// should never happen
}
return out.toString();
}
示例5: printClusterStateInfo
import org.noggit.CharArr; //导入方法依赖的package包/类
protected String printClusterStateInfo(String collection) throws Exception {
cloudClient.getZkStateReader().updateClusterState(true);
String cs = null;
ClusterState clusterState = cloudClient.getZkStateReader().getClusterState();
if (collection != null) {
cs = clusterState.getCollection(collection).toString();
} else {
Map<String,DocCollection> map = new HashMap<String,DocCollection>();
for (String coll : clusterState.getCollections())
map.put(coll, clusterState.getCollection(coll));
CharArr out = new CharArr();
new JSONWriter(out, 2).write(map);
cs = out.toString();
}
return cs;
}
示例6: printClusterStateInfo
import org.noggit.CharArr; //导入方法依赖的package包/类
protected static String printClusterStateInfo(String collection) throws Exception {
cloudSolrClient.getZkStateReader().forceUpdateCollection(collection);
String cs;
ClusterState clusterState = cloudSolrClient.getZkStateReader().getClusterState();
if (collection != null) {
cs = clusterState.getCollection(collection).toString();
} else {
Map<String, DocCollection> map = clusterState.getCollectionsMap();
CharArr out = new CharArr();
new JSONWriter(out, 2).write(map);
cs = out.toString();
}
return cs;
}
示例7: toJsonString
import org.noggit.CharArr; //导入方法依赖的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();
}
示例8: toJSON
import org.noggit.CharArr; //导入方法依赖的package包/类
public static String toJSON(Doc doc) {
CharArr out = new CharArr();
try {
out.append("{\"add\":{\"doc\":{");
boolean firstField = true;
for (Fld fld : doc.fields) {
if (firstField) firstField=false;
else out.append(',');
JSONUtil.writeString(fld.ftype.fname, 0, fld.ftype.fname.length(), out);
out.append(':');
if (fld.vals.size() > 1) {
out.append('[');
}
boolean firstVal = true;
for (Comparable val : fld.vals) {
if (firstVal) firstVal=false;
else out.append(',');
out.append(JSONUtil.toJSON(val));
}
if (fld.vals.size() > 1) {
out.append(']');
}
}
out.append("}}}");
} catch (IOException e) {
// should never happen
}
return out.toString();
}
示例9: json
import org.noggit.CharArr; //导入方法依赖的package包/类
/** Creates JSON from a SolrInputDocument. Doesn't currently handle boosts.
* @see #json(SolrInputDocument,CharArr)
*/
public static String json(SolrInputDocument doc) {
CharArr out = new CharArr();
json(doc, out);
return out.toString();
}
示例10: toString
import org.noggit.CharArr; //导入方法依赖的package包/类
public String toString() {
CharArr arr = new CharArr();
new JSONWriter(arr, 2).write(asMap());
return arr.toString();
}