当前位置: 首页>>代码示例>>Java>>正文


Java Kryo.writeObjectOrNull方法代码示例

本文整理汇总了Java中com.esotericsoftware.kryo.Kryo.writeObjectOrNull方法的典型用法代码示例。如果您正苦于以下问题:Java Kryo.writeObjectOrNull方法的具体用法?Java Kryo.writeObjectOrNull怎么用?Java Kryo.writeObjectOrNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.esotericsoftware.kryo.Kryo的用法示例。


在下文中一共展示了Kryo.writeObjectOrNull方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: write

import com.esotericsoftware.kryo.Kryo; //导入方法依赖的package包/类
@Override
public void write(Kryo kryo, Output output, BSpline bSpline) {
    Class<? extends Vector> vectorType = null;
    if (bSpline.controlPoints != null && bSpline.controlPoints.length > 0)
        vectorType = bSpline.controlPoints[0].getClass();
    else if (bSpline.knots != null && bSpline.knots.size > 0)
        vectorType = ((Vector)bSpline.knots.first()).getClass();
    kryo.writeClass(output, vectorType);
    output.writeInt(bSpline.controlPoints != null ? bSpline.controlPoints.length : -1); // -1 for null array
    if (bSpline.controlPoints != null){
        for (int i = 0; i < bSpline.controlPoints.length; i++) {
            kryo.writeObjectOrNull(output, bSpline.controlPoints[i], vectorType);
        }
    }
    kryo.writeObjectOrNull(output, bSpline.knots, Array.class);
    output.writeInt(bSpline.degree, true);
    output.writeBoolean(bSpline.continuous);
    output.writeInt(bSpline.spanCount, true);
}
 
开发者ID:CypherCove,项目名称:gdx-cclibs,代码行数:20,代码来源:BSplineSerializer.java

示例2: write

import com.esotericsoftware.kryo.Kryo; //导入方法依赖的package包/类
@Override
public void write(Kryo kryo, Output output, SortedIntList list) {
    output.writeVarInt(list.size(), true);
    Serializer serializer = null;
    if (genericType != null) {
        if (serializer == null) serializer = kryo.getSerializer(genericType);
        genericType = null;
    }
    for (Iterator<SortedIntList.Node> iter = list.iterator(); iter.hasNext();){
        SortedIntList.Node node = iter.next();
        output.writeInt(node.index);
        if (serializer != null) {
            kryo.writeObjectOrNull(output, node.value, serializer);
        } else {
            kryo.writeClassAndObject(output, node.value);
        }
    }
}
 
开发者ID:CypherCove,项目名称:gdx-cclibs,代码行数:19,代码来源:SortedIntListSerializer.java

示例3: write

import com.esotericsoftware.kryo.Kryo; //导入方法依赖的package包/类
public void write (Kryo kryo, Output output, LongMap map) {
    int length = map.size;
    output.writeVarInt(length, true);
    output.writeBoolean(false); // whether type is written (in case future version of LongMap supports type awareness)

    Serializer valueSerializer = null;
    if (valueGenericType != null) {
        if (valueSerializer == null) valueSerializer = kryo.getSerializer(valueGenericType);
        valueGenericType = null;
    }

    for (Iterator iter = map.iterator(); iter.hasNext();) {
        LongMap.Entry entry = (LongMap.Entry)iter.next();
        output.writeLong(entry.key);
        if (valueSerializer != null) {
            kryo.writeObjectOrNull(output, entry.value, valueSerializer);
        } else
            kryo.writeClassAndObject(output, entry.value);
    }
}
 
开发者ID:CypherCove,项目名称:gdx-cclibs,代码行数:21,代码来源:LongMapSerializer.java

示例4: write

import com.esotericsoftware.kryo.Kryo; //导入方法依赖的package包/类
public void write (Kryo kryo, Output output, IntMap map) {
    int length = map.size;
    output.writeVarInt(length, true);
    output.writeBoolean(false); // whether type is written (in case future version of IntMap supports type awareness)
    Serializer valueSerializer = null;
    if (valueGenericType != null) {
        if (valueSerializer == null) valueSerializer = kryo.getSerializer(valueGenericType);
        valueGenericType = null;
    }

    for (Iterator iter = map.iterator(); iter.hasNext();) {
        IntMap.Entry entry = (IntMap.Entry)iter.next();
        output.writeInt(entry.key);
        if (valueSerializer != null) {
            kryo.writeObjectOrNull(output, entry.value, valueSerializer);
        } else
            kryo.writeClassAndObject(output, entry.value);
    }
}
 
开发者ID:CypherCove,项目名称:gdx-cclibs,代码行数:20,代码来源:IntMapSerializer.java

示例5: serialize

import com.esotericsoftware.kryo.Kryo; //导入方法依赖的package包/类
@Override
public byte[] serialize(Object[] objects) {
  Output output = new Output(DEFAULT_BUFFER_SIZE, -1);

  Kryo kryo = pool.borrow();
  kryo.writeObjectOrNull(output, objects, Object[].class);
  pool.release(kryo);

  return output.toBytes();
}
 
开发者ID:apache,项目名称:incubator-servicecomb-saga,代码行数:11,代码来源:KryoMessageFormat.java

示例6: write

import com.esotericsoftware.kryo.Kryo; //导入方法依赖的package包/类
@Override
public void write(Kryo kryo, Output output, CatmullRomSpline catmullRomSpline) {
    Class<? extends Vector> vectorType = null;
    if (catmullRomSpline.controlPoints != null && catmullRomSpline.controlPoints.length > 0)
        vectorType = catmullRomSpline.controlPoints[0].getClass();
    kryo.writeClass(output, vectorType);
    output.writeInt(catmullRomSpline.controlPoints != null ? catmullRomSpline.controlPoints.length : -1); // -1 for null array
    if (catmullRomSpline.controlPoints != null){
        for (int i = 0; i < catmullRomSpline.controlPoints.length; i++) {
            kryo.writeObjectOrNull(output, catmullRomSpline.controlPoints[i], vectorType);
        }
    }
    output.writeBoolean(catmullRomSpline.continuous);
    output.writeInt(catmullRomSpline.spanCount, true);
}
 
开发者ID:CypherCove,项目名称:gdx-cclibs,代码行数:16,代码来源:CatmullRomSplineSerializer.java

示例7: write

import com.esotericsoftware.kryo.Kryo; //导入方法依赖的package包/类
@Override
public void write(Kryo kryo, Output output, FloatCounter floatCounter) {
    kryo.writeObjectOrNull(output, floatCounter.mean, WindowedMean.class);
    output.writeInt(floatCounter.count);
    output.writeFloat(floatCounter.total);
    output.writeFloat(floatCounter.min);
    output.writeFloat(floatCounter.max);
    output.writeFloat(floatCounter.average);
    output.writeFloat(floatCounter.latest);
    output.writeFloat(floatCounter.value);
}
 
开发者ID:CypherCove,项目名称:gdx-cclibs,代码行数:12,代码来源:FloatCounterSerializer.java

示例8: write

import com.esotericsoftware.kryo.Kryo; //导入方法依赖的package包/类
public void write (Kryo kryo, Output output, T map) {
    int length = map.size;
    output.writeVarInt(length, true);
    output.writeBoolean(false); // whether type is written (in case future version of ObjectMap supports type awareness)

    Serializer keySerializer = null;
    if (keyGenericType != null) {
        if (keySerializer == null) keySerializer = kryo.getSerializer(keyGenericType);
        keyGenericType = null;
    }
    Serializer valueSerializer = null;
    if (valueGenericType != null) {
        if (valueSerializer == null) valueSerializer = kryo.getSerializer(valueGenericType);
        valueGenericType = null;
    }

    for (Iterator iter = map.iterator(); iter.hasNext();) {
        ObjectMap.Entry entry = (ObjectMap.Entry)iter.next();
        if (keySerializer != null) {
            kryo.writeObject(output, entry.key, keySerializer);
        } else
            kryo.writeClassAndObject(output, entry.key);
        if (valueSerializer != null) {
            kryo.writeObjectOrNull(output, entry.value, valueSerializer);
        } else
            kryo.writeClassAndObject(output, entry.value);
    }
}
 
开发者ID:CypherCove,项目名称:gdx-cclibs,代码行数:29,代码来源:ObjectMapSerializer.java

示例9: write

import com.esotericsoftware.kryo.Kryo; //导入方法依赖的package包/类
public void write (Kryo kryo, Output output, ArrayMap map) {
    output.writeBoolean(map.ordered);
    int length = map.size;
    output.writeVarInt(length, true);
    kryo.writeClass(output, map.keys.getClass().getComponentType());
    kryo.writeClass(output, map.values.getClass().getComponentType());

    Serializer keySerializer = null;
    if (keyGenericType != null) {
        if (keySerializer == null) keySerializer = kryo.getSerializer(keyGenericType);
        keyGenericType = null;
    }
    Serializer valueSerializer = null;
    if (valueGenericType != null) {
        if (valueSerializer == null) valueSerializer = kryo.getSerializer(valueGenericType);
        valueGenericType = null;
    }

    for (Iterator iter = map.iterator(); iter.hasNext();) {
        ObjectMap.Entry entry = (ObjectMap.Entry)iter.next();
        if (keySerializer != null) {
            kryo.writeObject(output, entry.key, keySerializer);
        } else
            kryo.writeClassAndObject(output, entry.key);
        if (valueSerializer != null) {
            kryo.writeObjectOrNull(output, entry.value, valueSerializer);
        } else
            kryo.writeClassAndObject(output, entry.value);
    }
}
 
开发者ID:CypherCove,项目名称:gdx-cclibs,代码行数:31,代码来源:ArrayMapSerializer.java

示例10: write

import com.esotericsoftware.kryo.Kryo; //导入方法依赖的package包/类
public void write (Kryo kryo, Output output, IdentityMap map) {
    int length = map.size;
    output.writeVarInt(length, true);
    output.writeBoolean(false); // whether type is written (in case future version of IdentityMap supports type awareness)

    Serializer keySerializer = null;
    if (keyGenericType != null) {
        if (keySerializer == null) keySerializer = kryo.getSerializer(keyGenericType);
        keyGenericType = null;
    }
    Serializer valueSerializer = null;
    if (valueGenericType != null) {
        if (valueSerializer == null) valueSerializer = kryo.getSerializer(valueGenericType);
        valueGenericType = null;
    }

    for (Iterator iter = map.iterator(); iter.hasNext();) {
        IdentityMap.Entry entry = (IdentityMap.Entry)iter.next();
        if (keySerializer != null) {
            kryo.writeObject(output, entry.key, keySerializer);
        } else
            kryo.writeClassAndObject(output, entry.key);
        if (valueSerializer != null) {
            kryo.writeObjectOrNull(output, entry.value, valueSerializer);
        } else
            kryo.writeClassAndObject(output, entry.value);
    }
}
 
开发者ID:CypherCove,项目名称:gdx-cclibs,代码行数:29,代码来源:IdentityMapSerializer.java

示例11: write

import com.esotericsoftware.kryo.Kryo; //导入方法依赖的package包/类
@Override
public void write(Kryo kryo, Output output, Bezier bezier) {
    kryo.writeObjectOrNull(output, bezier.points, Array.class);
}
 
开发者ID:CypherCove,项目名称:gdx-cclibs,代码行数:5,代码来源:BezierSerializer.java


注:本文中的com.esotericsoftware.kryo.Kryo.writeObjectOrNull方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。