本文整理了Java中com.esotericsoftware.kryo.util.Util.string()
方法的一些代码示例,展示了Util.string()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.string()
方法的具体详情如下:
包路径:com.esotericsoftware.kryo.util.Util
类名称:Util
方法名:string
[英]Returns the object formatted as a string. The format depends on the object's type and whether Object#toString() has been overridden.
[中]返回格式化为字符串的对象。格式取决于对象的类型以及对象#toString()是否已被重写。
代码示例来源:origin: com.esotericsoftware/kryo
/** Logs a message about an object. The log level and the string format of the object depend on the object type. */
static public void log (String message, Object object) {
if (object == null) {
if (TRACE) trace("kryo", message + ": null");
return;
}
Class type = object.getClass();
if (type.isPrimitive() || type == Boolean.class || type == Byte.class || type == Character.class || type == Short.class
|| type == Integer.class || type == Long.class || type == Float.class || type == Double.class || type == String.class) {
if (TRACE) trace("kryo", message + ": " + string(object));
} else {
debug("kryo", message + ": " + string(object));
}
}
代码示例来源:origin: com.esotericsoftware.kryo/kryo
/** Logs a message about an object. The log level and the string format of the object depend on the object type. */
static public void log (String message, Object object) {
if (object == null) {
if (TRACE) trace("kryo", message + ": null");
return;
}
Class type = object.getClass();
if (type.isPrimitive() || type == Boolean.class || type == Byte.class || type == Character.class || type == Short.class
|| type == Integer.class || type == Long.class || type == Float.class || type == Double.class || type == String.class) {
if (TRACE) trace("kryo", message + ": " + string(object));
} else {
debug("kryo", message + ": " + string(object));
}
}
代码示例来源:origin: com.esotericsoftware/kryo-shaded
/** Logs a message about an object. The log level and the string format of the object depend on the object type. */
static public void log (String message, Object object) {
if (object == null) {
if (TRACE) trace("kryo", message + ": null");
return;
}
Class type = object.getClass();
if (type.isPrimitive() || type == Boolean.class || type == Byte.class || type == Character.class || type == Short.class
|| type == Integer.class || type == Long.class || type == Float.class || type == Double.class || type == String.class) {
if (TRACE) trace("kryo", message + ": " + string(object));
} else {
debug("kryo", message + ": " + string(object));
}
}
代码示例来源:origin: svn2github/kryo
/** Logs a message about an object. The log level and the string format of the object depend on the object type. */
static public void log (String message, Object object) {
if (object == null) {
if (TRACE) trace("kryo", message + ": null");
return;
}
Class type = object.getClass();
if (type.isPrimitive() || type == Boolean.class || type == Byte.class || type == Character.class || type == Short.class
|| type == Integer.class || type == Long.class || type == Float.class || type == Double.class || type == String.class) {
if (TRACE) trace("kryo", message + ": " + string(object));
} else {
debug("kryo", message + ": " + string(object));
}
}
代码示例来源:origin: com.esotericsoftware/kryo-shaded
/** @param object May be null if mayBeNull is true.
* @return true if no bytes need to be written for the object. */
boolean writeReferenceOrNull (Output output, Object object, boolean mayBeNull) {
if (object == null) {
if (TRACE || (DEBUG && depth == 1)) log("Write", null);
output.writeVarInt(Kryo.NULL, true);
return true;
}
if (!referenceResolver.useReferences(object.getClass())) {
if (mayBeNull) output.writeVarInt(Kryo.NOT_NULL, true);
return false;
}
// Determine if this object has already been seen in this object graph.
int id = referenceResolver.getWrittenId(object);
// If not the first time encountered, only write reference ID.
if (id != -1) {
if (DEBUG) debug("kryo", "Write object reference " + id + ": " + string(object));
output.writeVarInt(id + 2, true); // + 2 because 0 and 1 are used for NULL and NOT_NULL.
return true;
}
// Otherwise write NOT_NULL and then the object bytes.
id = referenceResolver.addWrittenObject(object);
output.writeVarInt(NOT_NULL, true);
if (TRACE) trace("kryo", "Write initial object reference " + id + ": " + string(object));
return false;
}
代码示例来源:origin: com.esotericsoftware/kryo
/** @param object May be null if mayBeNull is true.
* @return true if no bytes need to be written for the object. */
boolean writeReferenceOrNull (Output output, Object object, boolean mayBeNull) {
if (object == null) {
if (TRACE || (DEBUG && depth == 1)) log("Write", null);
output.writeVarInt(Kryo.NULL, true);
return true;
}
if (!referenceResolver.useReferences(object.getClass())) {
if (mayBeNull) output.writeVarInt(Kryo.NOT_NULL, true);
return false;
}
// Determine if this object has already been seen in this object graph.
int id = referenceResolver.getWrittenId(object);
// If not the first time encountered, only write reference ID.
if (id != -1) {
if (DEBUG) debug("kryo", "Write object reference " + id + ": " + string(object));
output.writeVarInt(id + 2, true); // + 2 because 0 and 1 are used for NULL and NOT_NULL.
return true;
}
// Otherwise write NOT_NULL and then the object bytes.
id = referenceResolver.addWrittenObject(object);
output.writeVarInt(NOT_NULL, true);
if (TRACE) trace("kryo", "Write initial object reference " + id + ": " + string(object));
return false;
}
代码示例来源:origin: com.esotericsoftware.kryo/kryo
/** @param object May be null if mayBeNull is true.
* @return true if no bytes need to be written for the object. */
boolean writeReferenceOrNull (Output output, Object object, boolean mayBeNull) {
if (object == null) {
if (TRACE || (DEBUG && depth == 1)) log("Write", null);
output.writeVarInt(Kryo.NULL, true);
return true;
}
if (!referenceResolver.useReferences(object.getClass())) {
if (mayBeNull) output.writeVarInt(Kryo.NOT_NULL, true);
return false;
}
// Determine if this object has already been seen in this object graph.
int id = referenceResolver.getWrittenId(object);
// If not the first time encountered, only write reference ID.
if (id != -1) {
if (DEBUG) debug("kryo", "Write object reference " + id + ": " + string(object));
output.writeVarInt(id + 2, true); // + 2 because 0 and 1 are used for NULL and NOT_NULL.
return true;
}
// Otherwise write NOT_NULL and then the object bytes.
id = referenceResolver.addWrittenObject(object);
output.writeVarInt(NOT_NULL, true);
if (TRACE) trace("kryo", "Write initial object reference " + id + ": " + string(object));
return false;
}
代码示例来源:origin: svn2github/kryo
/** @param object May be null if mayBeNull is true.
* @return true if no bytes need to be written for the object. */
boolean writeReferenceOrNull (Output output, Object object, boolean mayBeNull) {
if (object == null) {
if (TRACE || (DEBUG && depth == 1)) log("Write", null);
output.writeVarInt(Kryo.NULL, true);
return true;
}
if (!referenceResolver.useReferences(object.getClass())) {
if (mayBeNull) output.writeVarInt(Kryo.NOT_NULL, true);
return false;
}
// Determine if this object has already been seen in this object graph.
int id = referenceResolver.getWrittenId(object);
// If not the first time encountered, only write reference ID.
if (id != -1) {
if (DEBUG) debug("kryo", "Write object reference " + id + ": " + string(object));
output.writeVarInt(id + 2, true); // + 2 because 0 and 1 are used for NULL and NOT_NULL.
return true;
}
// Otherwise write NOT_NULL and then the object bytes.
id = referenceResolver.addWrittenObject(object);
output.writeVarInt(NOT_NULL, true);
if (TRACE) trace("kryo", "Write initial object reference " + id + ": " + string(object));
return false;
}
代码示例来源:origin: com.esotericsoftware/kryo
if (DEBUG) debug("kryo", "Read object reference " + id + ": " + string(readObject));
return REF;
代码示例来源:origin: com.esotericsoftware.kryo/kryo
if (DEBUG) debug("kryo", "Read object reference " + id + ": " + string(readObject));
return REF;
代码示例来源:origin: com.esotericsoftware/kryo-shaded
if (DEBUG) debug("kryo", "Read object reference " + id + ": " + string(readObject));
return REF;
代码示例来源:origin: svn2github/kryo
if (DEBUG) debug("kryo", "Read object reference " + id + ": " + string(readObject));
return REF;
内容来源于网络,如有侵权,请联系作者删除!