/** 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)); } }
/** 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)); } }
/** 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)); } }
/** 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)); } }
/** @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; }
/** @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; }
/** @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; }
/** @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; }
if (DEBUG) debug("kryo", "Read object reference " + id + ": " + string(readObject)); return REF;
if (DEBUG) debug("kryo", "Read object reference " + id + ": " + string(readObject)); return REF;
if (DEBUG) debug("kryo", "Read object reference " + id + ": " + string(readObject)); return REF;
if (DEBUG) debug("kryo", "Read object reference " + id + ": " + string(readObject)); return REF;