本文整理了Java中com.esotericsoftware.kryo.Kryo.readReferenceOrNull()
方法的一些代码示例,展示了Kryo.readReferenceOrNull()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Kryo.readReferenceOrNull()
方法的具体详情如下:
包路径:com.esotericsoftware.kryo.Kryo
类名称:Kryo
方法名:readReferenceOrNull
[英]Returns #REF if a reference to a previously read object was read, which is stored in #readObject. Returns a stack size (> 0) if a reference ID has been put on the stack.
[中]如果先前读取的对象的引用已读取,则返回#REF,该引用存储在#readObject中。如果引用ID已放在堆栈上,则返回堆栈大小(>0)。
代码示例来源:origin: com.esotericsoftware/kryo-shaded
/** Reads an object using the specified serializer. The registered serializer is ignored. */
public <T> T readObject (Input input, Class<T> type, Serializer serializer) {
if (input == null) throw new IllegalArgumentException("input cannot be null.");
if (type == null) throw new IllegalArgumentException("type cannot be null.");
if (serializer == null) throw new IllegalArgumentException("serializer cannot be null.");
beginObject();
try {
T object;
if (references) {
int stackSize = readReferenceOrNull(input, type, false);
if (stackSize == REF) return (T)readObject;
object = (T)serializer.read(this, input, type);
if (stackSize == readReferenceIds.size) reference(object);
} else
object = (T)serializer.read(this, input, type);
if (TRACE || (DEBUG && depth == 1)) log("Read", object);
return object;
} finally {
if (--depth == 0 && autoReset) reset();
}
}
代码示例来源:origin: com.esotericsoftware.kryo/kryo
/** Reads an object using the specified serializer. The registered serializer is ignored. */
public <T> T readObject (Input input, Class<T> type, Serializer serializer) {
if (input == null) throw new IllegalArgumentException("input cannot be null.");
if (type == null) throw new IllegalArgumentException("type cannot be null.");
if (serializer == null) throw new IllegalArgumentException("serializer cannot be null.");
beginObject();
try {
T object;
if (references) {
int stackSize = readReferenceOrNull(input, type, false);
if (stackSize == REF) return (T)readObject;
object = (T)serializer.read(this, input, type);
if (stackSize == readReferenceIds.size) reference(object);
} else
object = (T)serializer.read(this, input, type);
if (TRACE || (DEBUG && depth == 1)) log("Read", object);
return object;
} finally {
if (--depth == 0 && autoReset) reset();
}
}
代码示例来源:origin: com.esotericsoftware/kryo
/** Reads an object using the specified serializer. The registered serializer is ignored. */
public <T> T readObject (Input input, Class<T> type, Serializer serializer) {
if (input == null) throw new IllegalArgumentException("input cannot be null.");
if (type == null) throw new IllegalArgumentException("type cannot be null.");
if (serializer == null) throw new IllegalArgumentException("serializer cannot be null.");
beginObject();
try {
T object;
if (references) {
int stackSize = readReferenceOrNull(input, type, false);
if (stackSize == REF) return (T)readObject;
object = (T)serializer.read(this, input, type);
if (stackSize == readReferenceIds.size) reference(object);
} else
object = (T)serializer.read(this, input, type);
if (TRACE || (DEBUG && depth == 1)) log("Read", object);
return object;
} finally {
if (--depth == 0 && autoReset) reset();
}
}
代码示例来源:origin: svn2github/kryo
/** Reads an object using the specified serializer. The registered serializer is ignored. */
public <T> T readObject (Input input, Class<T> type, Serializer serializer) {
if (input == null) throw new IllegalArgumentException("input cannot be null.");
if (type == null) throw new IllegalArgumentException("type cannot be null.");
if (serializer == null) throw new IllegalArgumentException("serializer cannot be null.");
beginObject();
try {
T object;
if (references) {
int stackSize = readReferenceOrNull(input, type, false);
if (stackSize == REF) return (T)readObject;
object = (T)serializer.read(this, input, type);
if (stackSize == readReferenceIds.size) reference(object);
} else
object = (T)serializer.read(this, input, type);
if (TRACE || (DEBUG && depth == 1)) log("Read", object);
return object;
} finally {
if (--depth == 0 && autoReset) reset();
}
}
代码示例来源:origin: com.esotericsoftware.kryo/kryo
/** Reads an object or null using the specified serializer. The registered serializer is ignored.
* @return May be null. */
public <T> T readObjectOrNull (Input input, Class<T> type, Serializer serializer) {
if (input == null) throw new IllegalArgumentException("input cannot be null.");
if (type == null) throw new IllegalArgumentException("type cannot be null.");
if (serializer == null) throw new IllegalArgumentException("serializer cannot be null.");
beginObject();
try {
T object;
if (references) {
int stackSize = readReferenceOrNull(input, type, true);
if (stackSize == REF) return (T)readObject;
object = (T)serializer.read(this, input, type);
if (stackSize == readReferenceIds.size) reference(object);
} else {
if (!serializer.getAcceptsNull() && input.readByte() == NULL) {
if (TRACE || (DEBUG && depth == 1)) log("Read", null);
return null;
}
object = (T)serializer.read(this, input, type);
}
if (TRACE || (DEBUG && depth == 1)) log("Read", object);
return object;
} finally {
if (--depth == 0 && autoReset) reset();
}
}
代码示例来源:origin: com.esotericsoftware/kryo
/** Reads an object or null using the specified serializer. The registered serializer is ignored.
* @return May be null. */
public <T> T readObjectOrNull (Input input, Class<T> type, Serializer serializer) {
if (input == null) throw new IllegalArgumentException("input cannot be null.");
if (type == null) throw new IllegalArgumentException("type cannot be null.");
if (serializer == null) throw new IllegalArgumentException("serializer cannot be null.");
beginObject();
try {
T object;
if (references) {
int stackSize = readReferenceOrNull(input, type, true);
if (stackSize == REF) return (T)readObject;
object = (T)serializer.read(this, input, type);
if (stackSize == readReferenceIds.size) reference(object);
} else {
if (!serializer.getAcceptsNull() && input.readByte() == NULL) {
if (TRACE || (DEBUG && depth == 1)) log("Read", null);
return null;
}
object = (T)serializer.read(this, input, type);
}
if (TRACE || (DEBUG && depth == 1)) log("Read", object);
return object;
} finally {
if (--depth == 0 && autoReset) reset();
}
}
代码示例来源:origin: com.esotericsoftware/kryo-shaded
/** Reads an object or null using the specified serializer. The registered serializer is ignored.
* @return May be null. */
public <T> T readObjectOrNull (Input input, Class<T> type, Serializer serializer) {
if (input == null) throw new IllegalArgumentException("input cannot be null.");
if (type == null) throw new IllegalArgumentException("type cannot be null.");
if (serializer == null) throw new IllegalArgumentException("serializer cannot be null.");
beginObject();
try {
T object;
if (references) {
int stackSize = readReferenceOrNull(input, type, true);
if (stackSize == REF) return (T)readObject;
object = (T)serializer.read(this, input, type);
if (stackSize == readReferenceIds.size) reference(object);
} else {
if (!serializer.getAcceptsNull() && input.readByte() == NULL) {
if (TRACE || (DEBUG && depth == 1)) log("Read", null);
return null;
}
object = (T)serializer.read(this, input, type);
}
if (TRACE || (DEBUG && depth == 1)) log("Read", object);
return object;
} finally {
if (--depth == 0 && autoReset) reset();
}
}
代码示例来源:origin: svn2github/kryo
/** Reads an object or null using the specified serializer. The registered serializer is ignored.
* @return May be null. */
public <T> T readObjectOrNull (Input input, Class<T> type, Serializer serializer) {
if (input == null) throw new IllegalArgumentException("input cannot be null.");
if (type == null) throw new IllegalArgumentException("type cannot be null.");
if (serializer == null) throw new IllegalArgumentException("serializer cannot be null.");
beginObject();
try {
T object;
if (references) {
int stackSize = readReferenceOrNull(input, type, true);
if (stackSize == REF) return (T)readObject;
object = (T)serializer.read(this, input, type);
if (stackSize == readReferenceIds.size) reference(object);
} else {
if (!serializer.getAcceptsNull() && input.readByte() == NULL) {
if (TRACE || (DEBUG && depth == 1)) log("Read", null);
return null;
}
object = (T)serializer.read(this, input, type);
}
if (TRACE || (DEBUG && depth == 1)) log("Read", object);
return object;
} finally {
if (--depth == 0 && autoReset) reset();
}
}
代码示例来源:origin: com.esotericsoftware.kryo/kryo
/** Reads an object using the registered serializer. */
public <T> T readObject (Input input, Class<T> type) {
if (input == null) throw new IllegalArgumentException("input cannot be null.");
if (type == null) throw new IllegalArgumentException("type cannot be null.");
beginObject();
try {
T object;
if (references) {
int stackSize = readReferenceOrNull(input, type, false);
if (stackSize == REF) return (T)readObject;
object = (T)getRegistration(type).getSerializer().read(this, input, type);
if (stackSize == readReferenceIds.size) reference(object);
} else
object = (T)getRegistration(type).getSerializer().read(this, input, type);
if (TRACE || (DEBUG && depth == 1)) log("Read", object);
return object;
} finally {
if (--depth == 0 && autoReset) reset();
}
}
代码示例来源:origin: com.esotericsoftware/kryo
/** Reads an object using the registered serializer. */
public <T> T readObject (Input input, Class<T> type) {
if (input == null) throw new IllegalArgumentException("input cannot be null.");
if (type == null) throw new IllegalArgumentException("type cannot be null.");
beginObject();
try {
T object;
if (references) {
int stackSize = readReferenceOrNull(input, type, false);
if (stackSize == REF) return (T)readObject;
object = (T)getRegistration(type).getSerializer().read(this, input, type);
if (stackSize == readReferenceIds.size) reference(object);
} else
object = (T)getRegistration(type).getSerializer().read(this, input, type);
if (TRACE || (DEBUG && depth == 1)) log("Read", object);
return object;
} finally {
if (--depth == 0 && autoReset) reset();
}
}
代码示例来源:origin: com.esotericsoftware/kryo-shaded
/** Reads an object using the registered serializer. */
public <T> T readObject (Input input, Class<T> type) {
if (input == null) throw new IllegalArgumentException("input cannot be null.");
if (type == null) throw new IllegalArgumentException("type cannot be null.");
beginObject();
try {
T object;
if (references) {
int stackSize = readReferenceOrNull(input, type, false);
if (stackSize == REF) return (T)readObject;
object = (T)getRegistration(type).getSerializer().read(this, input, type);
if (stackSize == readReferenceIds.size) reference(object);
} else
object = (T)getRegistration(type).getSerializer().read(this, input, type);
if (TRACE || (DEBUG && depth == 1)) log("Read", object);
return object;
} finally {
if (--depth == 0 && autoReset) reset();
}
}
代码示例来源:origin: svn2github/kryo
/** Reads an object using the registered serializer. */
public <T> T readObject (Input input, Class<T> type) {
if (input == null) throw new IllegalArgumentException("input cannot be null.");
if (type == null) throw new IllegalArgumentException("type cannot be null.");
beginObject();
try {
T object;
if (references) {
int stackSize = readReferenceOrNull(input, type, false);
if (stackSize == REF) return (T)readObject;
object = (T)getRegistration(type).getSerializer().read(this, input, type);
if (stackSize == readReferenceIds.size) reference(object);
} else
object = (T)getRegistration(type).getSerializer().read(this, input, type);
if (TRACE || (DEBUG && depth == 1)) log("Read", object);
return object;
} finally {
if (--depth == 0 && autoReset) reset();
}
}
代码示例来源:origin: com.esotericsoftware/kryo
/** Reads an object or null using the registered serializer.
* @return May be null. */
public <T> T readObjectOrNull (Input input, Class<T> type) {
if (input == null) throw new IllegalArgumentException("input cannot be null.");
if (type == null) throw new IllegalArgumentException("type cannot be null.");
beginObject();
try {
T object;
if (references) {
int stackSize = readReferenceOrNull(input, type, true);
if (stackSize == REF) return (T)readObject;
object = (T)getRegistration(type).getSerializer().read(this, input, type);
if (stackSize == readReferenceIds.size) reference(object);
} else {
Serializer serializer = getRegistration(type).getSerializer();
if (!serializer.getAcceptsNull() && input.readByte() == NULL) {
if (TRACE || (DEBUG && depth == 1)) log("Read", null);
return null;
}
object = (T)serializer.read(this, input, type);
}
if (TRACE || (DEBUG && depth == 1)) log("Read", object);
return object;
} finally {
if (--depth == 0 && autoReset) reset();
}
}
代码示例来源:origin: com.esotericsoftware.kryo/kryo
/** Reads an object or null using the registered serializer.
* @return May be null. */
public <T> T readObjectOrNull (Input input, Class<T> type) {
if (input == null) throw new IllegalArgumentException("input cannot be null.");
if (type == null) throw new IllegalArgumentException("type cannot be null.");
beginObject();
try {
T object;
if (references) {
int stackSize = readReferenceOrNull(input, type, true);
if (stackSize == REF) return (T)readObject;
object = (T)getRegistration(type).getSerializer().read(this, input, type);
if (stackSize == readReferenceIds.size) reference(object);
} else {
Serializer serializer = getRegistration(type).getSerializer();
if (!serializer.getAcceptsNull() && input.readByte() == NULL) {
if (TRACE || (DEBUG && depth == 1)) log("Read", null);
return null;
}
object = (T)serializer.read(this, input, type);
}
if (TRACE || (DEBUG && depth == 1)) log("Read", object);
return object;
} finally {
if (--depth == 0 && autoReset) reset();
}
}
代码示例来源:origin: com.esotericsoftware/kryo-shaded
/** Reads an object or null using the registered serializer.
* @return May be null. */
public <T> T readObjectOrNull (Input input, Class<T> type) {
if (input == null) throw new IllegalArgumentException("input cannot be null.");
if (type == null) throw new IllegalArgumentException("type cannot be null.");
beginObject();
try {
T object;
if (references) {
int stackSize = readReferenceOrNull(input, type, true);
if (stackSize == REF) return (T)readObject;
object = (T)getRegistration(type).getSerializer().read(this, input, type);
if (stackSize == readReferenceIds.size) reference(object);
} else {
Serializer serializer = getRegistration(type).getSerializer();
if (!serializer.getAcceptsNull() && input.readByte() == NULL) {
if (TRACE || (DEBUG && depth == 1)) log("Read", null);
return null;
}
object = (T)serializer.read(this, input, type);
}
if (TRACE || (DEBUG && depth == 1)) log("Read", object);
return object;
} finally {
if (--depth == 0 && autoReset) reset();
}
}
代码示例来源:origin: svn2github/kryo
/** Reads an object or null using the registered serializer.
* @return May be null. */
public <T> T readObjectOrNull (Input input, Class<T> type) {
if (input == null) throw new IllegalArgumentException("input cannot be null.");
if (type == null) throw new IllegalArgumentException("type cannot be null.");
beginObject();
try {
T object;
if (references) {
int stackSize = readReferenceOrNull(input, type, true);
if (stackSize == REF) return (T)readObject;
object = (T)getRegistration(type).getSerializer().read(this, input, type);
if (stackSize == readReferenceIds.size) reference(object);
} else {
Serializer serializer = getRegistration(type).getSerializer();
if (!serializer.getAcceptsNull() && input.readByte() == NULL) {
if (TRACE || (DEBUG && depth == 1)) log("Read", null);
return null;
}
object = (T)serializer.read(this, input, type);
}
if (TRACE || (DEBUG && depth == 1)) log("Read", object);
return object;
} finally {
if (--depth == 0 && autoReset) reset();
}
}
代码示例来源:origin: com.esotericsoftware/kryo
/** Reads the class and object or null using the registered serializer.
* @return May be null. */
public Object readClassAndObject (Input input) {
if (input == null) throw new IllegalArgumentException("input cannot be null.");
beginObject();
try {
Registration registration = readClass(input);
if (registration == null) return null;
Class type = registration.getType();
Object object;
if (references) {
registration.getSerializer().setGenerics(this, null);
int stackSize = readReferenceOrNull(input, type, false);
if (stackSize == REF) return readObject;
object = registration.getSerializer().read(this, input, type);
if (stackSize == readReferenceIds.size) reference(object);
} else
object = registration.getSerializer().read(this, input, type);
if (TRACE || (DEBUG && depth == 1)) log("Read", object);
return object;
} finally {
if (--depth == 0 && autoReset) reset();
}
}
代码示例来源:origin: com.esotericsoftware.kryo/kryo
/** Reads the class and object or null using the registered serializer.
* @return May be null. */
public Object readClassAndObject (Input input) {
if (input == null) throw new IllegalArgumentException("input cannot be null.");
beginObject();
try {
Registration registration = readClass(input);
if (registration == null) return null;
Class type = registration.getType();
Object object;
if (references) {
registration.getSerializer().setGenerics(this, null);
int stackSize = readReferenceOrNull(input, type, false);
if (stackSize == REF) return readObject;
object = registration.getSerializer().read(this, input, type);
if (stackSize == readReferenceIds.size) reference(object);
} else
object = registration.getSerializer().read(this, input, type);
if (TRACE || (DEBUG && depth == 1)) log("Read", object);
return object;
} finally {
if (--depth == 0 && autoReset) reset();
}
}
代码示例来源:origin: com.esotericsoftware/kryo-shaded
/** Reads the class and object or null using the registered serializer.
* @return May be null. */
public Object readClassAndObject (Input input) {
if (input == null) throw new IllegalArgumentException("input cannot be null.");
beginObject();
try {
Registration registration = readClass(input);
if (registration == null) return null;
Class type = registration.getType();
Object object;
if (references) {
registration.getSerializer().setGenerics(this, null);
int stackSize = readReferenceOrNull(input, type, false);
if (stackSize == REF) return readObject;
object = registration.getSerializer().read(this, input, type);
if (stackSize == readReferenceIds.size) reference(object);
} else
object = registration.getSerializer().read(this, input, type);
if (TRACE || (DEBUG && depth == 1)) log("Read", object);
return object;
} finally {
if (--depth == 0 && autoReset) reset();
}
}
代码示例来源:origin: svn2github/kryo
/** Reads the class and object or null using the registered serializer.
* @return May be null. */
public Object readClassAndObject (Input input) {
if (input == null) throw new IllegalArgumentException("input cannot be null.");
beginObject();
try {
Registration registration = readClass(input);
if (registration == null) return null;
Class type = registration.getType();
Object object;
if (references) {
registration.getSerializer().setGenerics(this, null);
int stackSize = readReferenceOrNull(input, type, false);
if (stackSize == REF) return readObject;
object = registration.getSerializer().read(this, input, type);
if (stackSize == readReferenceIds.size) reference(object);
} else
object = registration.getSerializer().read(this, input, type);
if (TRACE || (DEBUG && depth == 1)) log("Read", object);
return object;
} finally {
if (--depth == 0 && autoReset) reset();
}
}
内容来源于网络,如有侵权,请联系作者删除!