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


Java Output.writeObject方法代码示例

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


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

示例1: writeTo

import io.protostuff.Output; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
protected void writeTo(Output output, T message) throws IOException {
  if (!ProtobufFeatureUtils.isUseProtobufMapCodec()) {
    runtimeMapField.writeTo(output, message);
    return;
  }

  final Map<Object, Object> existing;
  try {
    existing = (Map<Object, Object>) field.get(message);
  } catch (Exception e) {
    throw new RuntimeException(e);
  }

  if (existing != null) {
    for (Entry<Object, Object> entry : existing.entrySet()) {
      output.writeObject(number, entry, entrySchema, true);
    }
  }
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:22,代码来源:RuntimeMapFieldProtobuf.java

示例2: writeUnmodifiableCollectionTo

import io.protostuff.Output; //导入方法依赖的package包/类
private static void writeUnmodifiableCollectionTo(Output output,
        Object value, Schema<?> currentSchema, IdStrategy strategy, int id)
        throws IOException
{
    final Object c;
    try
    {
        c = fUnmodifiableCollection_c.get(value);
    }
    catch (IllegalArgumentException | IllegalAccessException e)
    {
        throw new RuntimeException(e);
    }

    output.writeObject(id, c, strategy.POLYMORPHIC_COLLECTION_SCHEMA, false);
}
 
开发者ID:BFergerson,项目名称:Beam,代码行数:17,代码来源:PolymorphicCollectionSchema.java

示例3: writeCheckedCollectionTo

import io.protostuff.Output; //导入方法依赖的package包/类
private static void writeCheckedCollectionTo(Output output, Object value,
        Schema<?> currentSchema, IdStrategy strategy, int id)
        throws IOException
{
    final Object c, type;
    try
    {
        c = fCheckedCollection_c.get(value);
        type = fCheckedCollection_type.get(value);
    }
    catch (IllegalArgumentException | IllegalAccessException e)
    {
        throw new RuntimeException(e);
    }

    output.writeObject(id, c, strategy.POLYMORPHIC_COLLECTION_SCHEMA, false);
    output.writeObject(1, type, strategy.CLASS_SCHEMA, false);
}
 
开发者ID:BFergerson,项目名称:Beam,代码行数:19,代码来源:PolymorphicCollectionSchema.java

示例4: writeUnmodifiableMapTo

import io.protostuff.Output; //导入方法依赖的package包/类
private static void writeUnmodifiableMapTo(Output output, Object value,
        Schema<?> currentSchema, IdStrategy strategy, int id)
        throws IOException
{
    final Object m;
    try
    {
        m = fUnmodifiableMap_m.get(value);
    }
    catch (IllegalArgumentException | IllegalAccessException e)
    {
        throw new RuntimeException(e);
    }

    output.writeObject(id, m, strategy.POLYMORPHIC_MAP_SCHEMA, false);
}
 
开发者ID:BFergerson,项目名称:Beam,代码行数:17,代码来源:PolymorphicMapSchema.java

示例5: writeCheckedMapTo

import io.protostuff.Output; //导入方法依赖的package包/类
private static void writeCheckedMapTo(Output output, Object value,
        Schema<?> currentSchema, IdStrategy strategy, int id)
        throws IOException
{
    final Object m, keyType, valueType;
    try
    {
        m = fCheckedMap_m.get(value);
        keyType = fCheckedMap_keyType.get(value);
        valueType = fCheckedMap_valueType.get(value);
    }
    catch (IllegalArgumentException | IllegalAccessException e)
    {
        throw new RuntimeException(e);
    }

    output.writeObject(id, m, strategy.POLYMORPHIC_MAP_SCHEMA, false);
    output.writeObject(1, keyType, strategy.CLASS_SCHEMA, false);
    output.writeObject(2, valueType, strategy.CLASS_SCHEMA, false);
}
 
开发者ID:BFergerson,项目名称:Beam,代码行数:21,代码来源:PolymorphicMapSchema.java

示例6: writeUnmodifiableCollectionTo

import io.protostuff.Output; //导入方法依赖的package包/类
private static void writeUnmodifiableCollectionTo(Output output,
        Object value, Schema<?> currentSchema, IdStrategy strategy, int id)
        throws IOException
{
    final Object c;
    try
    {
        c = fUnmodifiableCollection_c.get(value);
    }
    catch (Exception e)
    {
        throw new RuntimeException(e);
    }

    output.writeObject(id, c, strategy.POLYMORPHIC_COLLECTION_SCHEMA, false);
}
 
开发者ID:protostuff,项目名称:protostuff,代码行数:17,代码来源:PolymorphicCollectionSchema.java

示例7: writeCheckedCollectionTo

import io.protostuff.Output; //导入方法依赖的package包/类
private static void writeCheckedCollectionTo(Output output, Object value,
        Schema<?> currentSchema, IdStrategy strategy, int id)
        throws IOException
{
    final Object c, type;
    try
    {
        c = fCheckedCollection_c.get(value);
        type = fCheckedCollection_type.get(value);
    }
    catch (Exception e)
    {
        throw new RuntimeException(e);
    }

    output.writeObject(id, c, strategy.POLYMORPHIC_COLLECTION_SCHEMA, false);
    output.writeObject(1, type, strategy.CLASS_SCHEMA, false);
}
 
开发者ID:protostuff,项目名称:protostuff,代码行数:19,代码来源:PolymorphicCollectionSchema.java

示例8: writeUnmodifiableMapTo

import io.protostuff.Output; //导入方法依赖的package包/类
private static void writeUnmodifiableMapTo(Output output, Object value,
        Schema<?> currentSchema, IdStrategy strategy, int id)
        throws IOException
{
    final Object m;
    try
    {
        m = fUnmodifiableMap_m.get(value);
    }
    catch (Exception e)
    {
        throw new RuntimeException(e);
    }

    output.writeObject(id, m, strategy.POLYMORPHIC_MAP_SCHEMA, false);
}
 
开发者ID:protostuff,项目名称:protostuff,代码行数:17,代码来源:PolymorphicMapSchema.java

示例9: writeCheckedMapTo

import io.protostuff.Output; //导入方法依赖的package包/类
private static void writeCheckedMapTo(Output output, Object value,
        Schema<?> currentSchema, IdStrategy strategy, int id)
        throws IOException
{
    final Object m, keyType, valueType;
    try
    {
        m = fCheckedMap_m.get(value);
        keyType = fCheckedMap_keyType.get(value);
        valueType = fCheckedMap_valueType.get(value);
    }
    catch (Exception e)
    {
        throw new RuntimeException(e);
    }

    output.writeObject(id, m, strategy.POLYMORPHIC_MAP_SCHEMA, false);
    output.writeObject(1, keyType, strategy.CLASS_SCHEMA, false);
    output.writeObject(2, valueType, strategy.CLASS_SCHEMA, false);
}
 
开发者ID:protostuff,项目名称:protostuff,代码行数:21,代码来源:PolymorphicMapSchema.java

示例10: writeSynchronizedCollectionTo

import io.protostuff.Output; //导入方法依赖的package包/类
private static void writeSynchronizedCollectionTo(Output output,
        Object value, Schema<?> currentSchema, IdStrategy strategy, int id)
        throws IOException
{
    final Object c, mutex;
    try
    {
        c = fSynchronizedCollection_c.get(value);
        mutex = fSynchronizedCollection_mutex.get(value);
    }
    catch (IllegalArgumentException | IllegalAccessException e)
    {
        throw new RuntimeException(e);
    }

    if (mutex != value)
    {
        // TODO for future release, introduce an interface(GraphOutput) so
        // we
        // can check whether the output can retain references.
        throw new RuntimeException(
                "This exception is thrown to fail fast. "
                        + "Synchronized collections with a different mutex would only "
                        + "work if graph format is used, since the reference is retained.");
    }

    output.writeObject(id, c, strategy.POLYMORPHIC_COLLECTION_SCHEMA, false);
}
 
开发者ID:BFergerson,项目名称:Beam,代码行数:29,代码来源:PolymorphicCollectionSchema.java

示例11: transfer

import io.protostuff.Output; //导入方法依赖的package包/类
@Override
protected void transfer(Pipe pipe, Input input, Output output)
        throws IOException
{
    if (ID_ARRAY_LEN != input
            .readFieldNumber(pipeSchema.wrappedSchema))
        throw new ProtostuffException("Corrupt input.");

    final int len = input.readUInt32();
    // write it back
    output.writeUInt32(ID_ARRAY_LEN, len, false);

    for (int i = 0, nullCount = 0; i < len;)
    {
        switch (input.readFieldNumber(pipeSchema.wrappedSchema))
        {
            case ID_ARRAY_DATA:
                i++;
                output.writeObject(ID_ARRAY_DATA, pipe, hs.getPipeSchema(),
                        true);
                break;
            case ID_ARRAY_NULLCOUNT:
                nullCount = input.readUInt32();
                i += nullCount;
                output.writeUInt32(ID_ARRAY_NULLCOUNT, nullCount, false);
                break;
            default:
                throw new ProtostuffException("Corrupt input.");
        }
    }

    if (0 != input.readFieldNumber(pipeSchema.wrappedSchema))
        throw new ProtostuffException("Corrupt input.");
}
 
开发者ID:BFergerson,项目名称:Beam,代码行数:35,代码来源:ArraySchemas.java

示例12: writeTo

import io.protostuff.Output; //导入方法依赖的package包/类
@Override
public void writeTo(Output output, Object array) throws IOException
{
    final int len = Array.getLength(array);

    output.writeUInt32(ID_ARRAY_LEN, len, false);

    int nullCount = 0;
    for (int i = 0; i < len; i++)
    {
        Object v = Array.get(array, i);
        if (v != null)
        {
            if (nullCount != 0)
            {
                output.writeUInt32(ID_ARRAY_NULLCOUNT, nullCount, false);
                nullCount = 0;
            }

            output.writeObject(ID_ARRAY_DATA, v, hs.getSchema(), true);
        }
        else if (ALLOW_NULL_ARRAY_ELEMENT)
        {
            nullCount++;
        }
    }

    // if last element is null
    if (nullCount != 0)
        output.writeUInt32(ID_ARRAY_NULLCOUNT, nullCount, false);
}
 
开发者ID:BFergerson,项目名称:Beam,代码行数:32,代码来源:ArraySchemas.java

示例13: writeSynchronizedMapTo

import io.protostuff.Output; //导入方法依赖的package包/类
private static void writeSynchronizedMapTo(Output output, Object value,
        Schema<?> currentSchema, IdStrategy strategy, int id)
        throws IOException
{
    final Object m, mutex;
    try
    {
        m = fSynchronizedMap_m.get(value);
        mutex = fSynchronizedMap_mutex.get(value);
    }
    catch (IllegalArgumentException | IllegalAccessException e)
    {
        throw new RuntimeException(e);
    }

    if (mutex != value)
    {
        // TODO for future release, introduce an interface(GraphOutput) so
        // we
        // can check whether the output can retain references.
        throw new RuntimeException(
                "This exception is thrown to fail fast. "
                        + "Synchronized collections with a different mutex would only "
                        + "work if graph format is used, since the reference is retained.");
    }

    output.writeObject(id, m, strategy.POLYMORPHIC_MAP_SCHEMA, false);
}
 
开发者ID:BFergerson,项目名称:Beam,代码行数:29,代码来源:PolymorphicMapSchema.java

示例14: writeSynchronizedCollectionTo

import io.protostuff.Output; //导入方法依赖的package包/类
private static void writeSynchronizedCollectionTo(Output output,
        Object value, Schema<?> currentSchema, IdStrategy strategy, int id)
        throws IOException
{
    final Object c, mutex;
    try
    {
        c = fSynchronizedCollection_c.get(value);
        mutex = fSynchronizedCollection_mutex.get(value);
    }
    catch (Exception e)
    {
        throw new RuntimeException(e);
    }

    if (mutex != value)
    {
        // TODO for future release, introduce an interface(GraphOutput) so
        // we
        // can check whether the output can retain references.
        throw new RuntimeException(
                "This exception is thrown to fail fast. "
                        + "Synchronized collections with a different mutex would only "
                        + "work if graph format is used, since the reference is retained.");
    }

    output.writeObject(id, c, strategy.POLYMORPHIC_COLLECTION_SCHEMA, false);
}
 
开发者ID:protostuff,项目名称:protostuff,代码行数:29,代码来源:PolymorphicCollectionSchema.java

示例15: transfer

import io.protostuff.Output; //导入方法依赖的package包/类
@Override
protected void transfer(Pipe pipe, Input input, Output output)
        throws IOException
{
    if (ID_ARRAY_LEN != input
            .readFieldNumber(pipeSchema.wrappedSchema))
        throw new ProtostuffException("Corrupt input.");

    final int len = input.readInt32();
    // write it back
    output.writeInt32(ID_ARRAY_LEN, len, false);

    for (int i = 0, nullCount = 0; i < len;)
    {
        switch (input.readFieldNumber(pipeSchema.wrappedSchema))
        {
            case ID_ARRAY_DATA:
                i++;
                output.writeObject(ID_ARRAY_DATA, pipe, hs.getPipeSchema(),
                        true);
                break;
            case ID_ARRAY_NULLCOUNT:
                nullCount = input.readUInt32();
                i += nullCount;
                output.writeUInt32(ID_ARRAY_NULLCOUNT, nullCount, false);
                break;
            default:
                throw new ProtostuffException("Corrupt input.");
        }
    }

    if (0 != input.readFieldNumber(pipeSchema.wrappedSchema))
        throw new ProtostuffException("Corrupt input.");
}
 
开发者ID:protostuff,项目名称:protostuff,代码行数:35,代码来源:ArraySchemas.java


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