本文整理了Java中com.badlogic.gdx.utils.Json.toJson()
方法的一些代码示例,展示了Json.toJson()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Json.toJson()
方法的具体详情如下:
包路径:com.badlogic.gdx.utils.Json
类名称:Json
方法名:toJson
暂无
代码示例来源:origin: libgdx/libgdx
/** @param knownType May be null if the type is unknown. */
public void toJson (Object object, Class knownType, Writer writer) {
toJson(object, knownType, null, writer);
}
代码示例来源:origin: libgdx/libgdx
/** @param knownType May be null if the type is unknown. */
public void toJson (Object object, Class knownType, FileHandle file) {
toJson(object, knownType, null, file);
}
代码示例来源:origin: libgdx/libgdx
/** @param knownType May be null if the type is unknown. */
public void toJson (Object object, Class knownType, Writer writer) {
toJson(object, knownType, null, writer);
}
代码示例来源:origin: libgdx/libgdx
/** @param knownType May be null if the type is unknown. */
public void toJson (Object object, Class knownType, FileHandle file) {
toJson(object, knownType, null, file);
}
代码示例来源:origin: libgdx/libgdx
public String toJson (Object object, Class knownType) {
return toJson(object, knownType, (Class)null);
}
代码示例来源:origin: libgdx/libgdx
public String toJson (Object object) {
return toJson(object, object == null ? null : object.getClass(), (Class)null);
}
代码示例来源:origin: libgdx/libgdx
public void toJson (Object object, Writer writer) {
toJson(object, object == null ? null : object.getClass(), null, writer);
}
代码示例来源:origin: libgdx/libgdx
public String toJson (Object object) {
return toJson(object, object == null ? null : object.getClass(), (Class)null);
}
代码示例来源:origin: libgdx/libgdx
public void toJson (Object object, Writer writer) {
toJson(object, object == null ? null : object.getClass(), null, writer);
}
代码示例来源:origin: libgdx/libgdx
public void toJson (Object object, FileHandle file) {
toJson(object, object == null ? null : object.getClass(), null, file);
}
代码示例来源:origin: libgdx/libgdx
/** @param knownType May be null if the type is unknown.
* @param elementType May be null if the type is unknown. */
public String toJson (Object object, Class knownType, Class elementType) {
StringWriter buffer = new StringWriter();
toJson(object, knownType, elementType, buffer);
return buffer.toString();
}
代码示例来源:origin: libgdx/libgdx
/** @param knownType May be null if the type is unknown.
* @param elementType May be null if the type is unknown. */
public String toJson (Object object, Class knownType, Class elementType) {
StringWriter buffer = new StringWriter();
toJson(object, knownType, elementType, buffer);
return buffer.toString();
}
代码示例来源:origin: libgdx/libgdx
public String prettyPrint (Object object, int singleLineColumns) {
return prettyPrint(toJson(object), singleLineColumns);
}
代码示例来源:origin: libgdx/libgdx
public String prettyPrint (Object object, PrettyPrintSettings settings) {
return prettyPrint(toJson(object), settings);
}
代码示例来源:origin: libgdx/libgdx
public String prettyPrint (Object object, int singleLineColumns) {
return prettyPrint(toJson(object), singleLineColumns);
}
代码示例来源:origin: libgdx/libgdx
private String roundTrip (Object object) {
String text = json.toJson(object);
System.out.println(text);
test(text, object);
text = json.prettyPrint(object, 130);
test(text, object);
return text;
}
代码示例来源:origin: libgdx/libgdx
/** Sets the correct {@code ContentType} and encodes the given content object via {@link #json}, then sets it as the content. */
public HttpRequestBuilder jsonContent (Object content) {
validate();
httpRequest.setHeader(HttpRequestHeader.ContentType, "application/json");
String jsonContent = json.toJson(content);
httpRequest.setContent(jsonContent);
return this;
}
代码示例来源:origin: libgdx/libgdx
/** Sets the correct {@code ContentType} and encodes the given content object via {@link #json}, then sets it as the content. */
public HttpRequestBuilder jsonContent (Object content) {
validate();
httpRequest.setHeader(HttpRequestHeader.ContentType, "application/json");
String jsonContent = json.toJson(content);
httpRequest.setContent(jsonContent);
return this;
}
代码示例来源:origin: libgdx/libgdx
/** @param knownType May be null if the type is unknown.
* @param elementType May be null if the type is unknown. */
public void toJson (Object object, Class knownType, Class elementType, FileHandle file) {
Writer writer = null;
try {
writer = file.writer(false, "UTF-8");
toJson(object, knownType, elementType, writer);
} catch (Exception ex) {
throw new SerializationException("Error writing file: " + file, ex);
} finally {
StreamUtils.closeQuietly(writer);
}
}
代码示例来源:origin: libgdx/libgdx
/** @param knownType May be null if the type is unknown.
* @param elementType May be null if the type is unknown. */
public void toJson (Object object, Class knownType, Class elementType, FileHandle file) {
Writer writer = null;
try {
writer = file.writer(false, "UTF-8");
toJson(object, knownType, elementType, writer);
} catch (Exception ex) {
throw new SerializationException("Error writing file: " + file, ex);
} finally {
StreamUtils.closeQuietly(writer);
}
}
内容来源于网络,如有侵权,请联系作者删除!