本文整理匯總了Java中com.esotericsoftware.kryo.io.Input.readVarInt方法的典型用法代碼示例。如果您正苦於以下問題:Java Input.readVarInt方法的具體用法?Java Input.readVarInt怎麽用?Java Input.readVarInt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.esotericsoftware.kryo.io.Input
的用法示例。
在下文中一共展示了Input.readVarInt方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: read
import com.esotericsoftware.kryo.io.Input; //導入方法依賴的package包/類
@Override
public Queue read(Kryo kryo, Input input, Class<Queue> type) {
int length = input.readVarInt(true);
Registration registration = kryo.readClass(input);
Class cls = registration == null ? Object.class : registration.getType();
Queue queue = new Queue(length, cls);
kryo.reference(queue);
Class elementClass = null;
Serializer serializer = null;
if (genericType != null) {
elementClass = genericType;
serializer = kryo.getSerializer(genericType);
genericType = null;
}
if (serializer != null) {
for (int i = 0; i < length; i++)
queue.addLast(kryo.readObjectOrNull(input, elementClass, serializer));
} else {
for (int i = 0; i < length; i++)
queue.addLast(kryo.readClassAndObject(input));
}
return queue;
}
示例2: read
import com.esotericsoftware.kryo.io.Input; //導入方法依賴的package包/類
@Override
public SortedIntList read(Kryo kryo, Input input, Class<SortedIntList> type) {
int length = input.readVarInt(true);
SortedIntList list = new SortedIntList();
kryo.reference(list);
Class elementClass = null;
Serializer serializer = null;
if (genericType != null) {
elementClass = genericType;
serializer = kryo.getSerializer(genericType);
genericType = null;
}
for (int i = 0; i < length; i++) {
int index = input.readInt();
Object value = serializer != null ?
kryo.readObjectOrNull(input, elementClass, serializer) : kryo.readClassAndObject(input);
list.insert(index, value);
}
return list;
}
示例3: read
import com.esotericsoftware.kryo.io.Input; //導入方法依賴的package包/類
@Override
public T read(Kryo kryo, Input input, Class<T> type) {
int length = input.readVarInt(true);
boolean ordered = input.readBoolean();
Class cls = kryo.readClass(input).getType();
T array = create(ordered, length, cls);
kryo.reference(array);
Class elementClass = null;
Serializer serializer = null;
if (genericType != null) {
elementClass = genericType;
serializer = kryo.getSerializer(genericType);
genericType = null;
}
if (serializer != null) {
for (int i = 0; i < length; i++)
array.add(kryo.readObjectOrNull(input, elementClass, serializer));
} else {
for (int i = 0; i < length; i++)
array.add(kryo.readClassAndObject(input));
}
return array;
}
示例4: read
import com.esotericsoftware.kryo.io.Input; //導入方法依賴的package包/類
@Override
public T read(Kryo kryo, Input input, Class<T> type) {
int length = input.readVarInt(true);
input.readBoolean(); // currently unused
T objectSet = create(length);
kryo.reference(objectSet);
Class elementClass = null;
Serializer serializer = null;
if (genericType != null) {
elementClass = genericType;
serializer = kryo.getSerializer(genericType);
genericType = null;
}
if (serializer != null) {
for (int i = 0; i < length; i++)
objectSet.add(kryo.readObject(input, elementClass, serializer));
} else {
for (int i = 0; i < length; i++)
objectSet.add(kryo.readClassAndObject(input));
}
return objectSet;
}
示例5: read
import com.esotericsoftware.kryo.io.Input; //導入方法依賴的package包/類
public IntMap read (Kryo kryo, Input input, Class<IntMap> type) {
int length = input.readVarInt(true);
input.readBoolean(); // currently unused
IntMap map = new IntMap(length);
Class valueClass = null;
Serializer valueSerializer = null;
if (valueGenericType != null) {
valueClass = valueGenericType;
if (valueSerializer == null) valueSerializer = kryo.getSerializer(valueClass);
valueGenericType = null;
}
kryo.reference(map);
for (int i = 0; i < length; i++) {
int key = input.readInt();
Object value;
if (valueSerializer != null) {
value = kryo.readObjectOrNull(input, valueClass, valueSerializer);
} else
value = kryo.readClassAndObject(input);
map.put(key, value);
}
return map;
}
示例6: read
import com.esotericsoftware.kryo.io.Input; //導入方法依賴的package包/類
@Override
public IntSet read(Kryo kryo, Input input, Class<IntSet> type) {
int length = input.readVarInt(true);
IntSet array = new IntSet(length);
for (int i = 0; i < length; i++) {
array.add(input.readInt());
}
return array;
}
示例7: read
import com.esotericsoftware.kryo.io.Input; //導入方法依賴的package包/類
@Override
public CharArray read(Kryo kryo, Input input, Class<CharArray> type) {
int length = input.readVarInt(true);
boolean ordered = input.readBoolean();
CharArray array = new CharArray(ordered, length);
for (int i = 0; i < length; i++) {
array.add(input.readChar());
}
return array;
}
示例8: read
import com.esotericsoftware.kryo.io.Input; //導入方法依賴的package包/類
public T read (Kryo kryo, Input input, Class<T> type) {
int length = input.readVarInt(true);
input.readBoolean(); // currently unused
T map = create(length);
Class keyClass = null;
Class valueClass = null;
Serializer keySerializer = null;
if (keyGenericType != null) {
keyClass = keyGenericType;
if (keySerializer == null) keySerializer = kryo.getSerializer(keyClass);
keyGenericType = null;
}
Serializer valueSerializer = null;
if (valueGenericType != null) {
valueClass = valueGenericType;
if (valueSerializer == null) valueSerializer = kryo.getSerializer(valueClass);
valueGenericType = null;
}
kryo.reference(map);
for (int i = 0; i < length; i++) {
Object key;
if (keySerializer != null) {
key = kryo.readObject(input, keyClass, keySerializer);
} else
key = kryo.readClassAndObject(input);
Object value;
if (valueSerializer != null) {
value = kryo.readObjectOrNull(input, valueClass, valueSerializer);
} else
value = kryo.readClassAndObject(input);
map.put(key, value);
}
return map;
}
示例9: read
import com.esotericsoftware.kryo.io.Input; //導入方法依賴的package包/類
public IntFloatMap read (Kryo kryo, Input input, Class<IntFloatMap> type) {
int length = input.readVarInt(true);
IntFloatMap map = new IntFloatMap(length);
for (int i = 0; i < length; i++) {
int key = input.readInt();
float value = input.readFloat();
map.put(key, value);
}
return map;
}
示例10: read
import com.esotericsoftware.kryo.io.Input; //導入方法依賴的package包/類
@Override
public FloatArray read(Kryo kryo, Input input, Class<FloatArray> type) {
int length = input.readVarInt(true);
boolean ordered = input.readBoolean();
FloatArray array = new FloatArray(ordered, length);
for (int i = 0; i < length; i++) {
array.add(input.readFloat());
}
return array;
}
示例11: read
import com.esotericsoftware.kryo.io.Input; //導入方法依賴的package包/類
public ObjectIntMap read (Kryo kryo, Input input, Class<ObjectIntMap> type) {
int length = input.readVarInt(true);
input.readBoolean(); // currently unused
ObjectIntMap map = create(length);
Class keyClass = null;
Serializer keySerializer = null;
if (keyGenericType != null) {
keyClass = keyGenericType;
if (keySerializer == null) keySerializer = kryo.getSerializer(keyClass);
keyGenericType = null;
}
kryo.reference(map);
for (int i = 0; i < length; i++) {
Object key;
if (keySerializer != null) {
key = kryo.readObject(input, keyClass, keySerializer);
} else
key = kryo.readClassAndObject(input);
int value = input.readInt();
map.put(key, value);
}
return map;
}
示例12: read
import com.esotericsoftware.kryo.io.Input; //導入方法依賴的package包/類
@Override
public LongArray read(Kryo kryo, Input input, Class<LongArray> type) {
int length = input.readVarInt(true);
boolean ordered = input.readBoolean();
LongArray array = new LongArray(ordered, length);
for (int i = 0; i < length; i++) {
array.add(input.readLong());
}
return array;
}
示例13: read
import com.esotericsoftware.kryo.io.Input; //導入方法依賴的package包/類
public IntIntMap read (Kryo kryo, Input input, Class<IntIntMap> type) {
int length = input.readVarInt(true);
IntIntMap map = new IntIntMap(length);
for (int i = 0; i < length; i++) {
int key = input.readInt();
int value = input.readInt();
map.put(key, value);
}
return map;
}
示例14: read
import com.esotericsoftware.kryo.io.Input; //導入方法依賴的package包/類
public IdentityMap read (Kryo kryo, Input input, Class<IdentityMap> type) {
int length = input.readVarInt(true);
input.readBoolean(); // currently unused
IdentityMap map = new IdentityMap(length);
Class keyClass = null;
Class valueClass = null;
Serializer keySerializer = null;
if (keyGenericType != null) {
keyClass = keyGenericType;
if (keySerializer == null) keySerializer = kryo.getSerializer(keyClass);
keyGenericType = null;
}
Serializer valueSerializer = null;
if (valueGenericType != null) {
valueClass = valueGenericType;
if (valueSerializer == null) valueSerializer = kryo.getSerializer(valueClass);
valueGenericType = null;
}
kryo.reference(map);
for (int i = 0; i < length; i++) {
Object key;
if (keySerializer != null) {
key = kryo.readObject(input, keyClass, keySerializer);
} else
key = kryo.readClassAndObject(input);
Object value;
if (valueSerializer != null) {
value = kryo.readObjectOrNull(input, valueClass, valueSerializer);
} else
value = kryo.readClassAndObject(input);
map.put(key, value);
}
return map;
}
示例15: read
import com.esotericsoftware.kryo.io.Input; //導入方法依賴的package包/類
@Override
public ByteArray read(Kryo kryo, Input input, Class<ByteArray> type) {
int length = input.readVarInt(true);
boolean ordered = input.readBoolean();
ByteArray array = new ByteArray(ordered, length);
for (int i = 0; i < length; i++) {
array.add(input.readByte());
}
return array;
}