本文整理汇总了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);
}
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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.");
}
示例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);
}
示例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);
}
示例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);
}
示例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.");
}