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


Java DataOutputView.writeUTF方法代码示例

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


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

示例1: write

import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void write(DataOutputView out) throws IOException {
	int num = this.aggNames.length;
	out.writeInt(num);

	ByteArrayOutputStream boas = new ByteArrayOutputStream();
	DataOutputViewStreamWrapper bufferStream = new DataOutputViewStreamWrapper(boas);

	for (int i = 0; i < num; i++) {
		// aggregator name and type
		out.writeUTF(this.aggNames[i]);
		out.writeUTF(this.aggregates[i].getClass().getName());

		// aggregator value indirect as a byte array
		this.aggregates[i].write(bufferStream);
		bufferStream.flush();
		byte[] bytes = boas.toByteArray();
		out.writeInt(bytes.length);
		out.write(bytes);
		boas.reset();
	}
	bufferStream.close();
	boas.close();
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:25,代码来源:IterationEventWithAggregators.java

示例2: writeStateMetaInfo

import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void writeStateMetaInfo(DataOutputView out) throws IOException {
	out.writeInt(stateMetaInfo.getStateType().ordinal());
	out.writeUTF(stateMetaInfo.getName());

	// write in a way that allows us to be fault-tolerant and skip blocks in the case of java serialization failures
	TypeSerializerSerializationUtil.writeSerializersAndConfigsWithResilience(
		out,
		Arrays.asList(
			new Tuple2<TypeSerializer<?>, TypeSerializerConfigSnapshot>(
				stateMetaInfo.getNamespaceSerializer(), stateMetaInfo.getNamespaceSerializerConfigSnapshot()),
			new Tuple2<TypeSerializer<?>, TypeSerializerConfigSnapshot>(
				stateMetaInfo.getStateSerializer(), stateMetaInfo.getStateSerializerConfigSnapshot())));
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:15,代码来源:KeyedBackendStateMetaInfoSnapshotReaderWriters.java

示例3: serialize

import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void serialize(
		KafkaTransactionContext record,
		DataOutputView target) throws IOException {
	int numIds = record.transactionalIds.size();
	target.writeInt(numIds);
	for (String id : record.transactionalIds) {
		target.writeUTF(id);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:11,代码来源:FlinkKafkaProducer011.java

示例4: copy

import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void copy(
		DataInputView source,
		DataOutputView target) throws IOException {
	int numIds = source.readInt();
	target.writeInt(numIds);
	for (int i = 0; i < numIds; i++) {
		target.writeUTF(source.readUTF());
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:11,代码来源:FlinkKafkaProducer011.java

示例5: write

import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void write(DataOutputView out) throws IOException {
	super.write(out);

	out.writeInt(kryoRegistrations.size());
	for (Map.Entry<String, KryoRegistration> kryoRegistrationEntry : kryoRegistrations.entrySet()) {
		out.writeUTF(kryoRegistrationEntry.getKey());
		new KryoRegistrationSerializationProxy<>(kryoRegistrationEntry.getValue()).write(out);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:11,代码来源:KryoRegistrationSerializerConfigSnapshot.java

示例6: write

import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void write(DataOutputView out) throws IOException {
	super.write(out);

	out.writeInt(enumConstants.size());
	for (String enumConstant : enumConstants) {
		out.writeUTF(enumConstant);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:10,代码来源:EnumSerializer.java

示例7: write

import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void write(DataOutputView out) throws IOException {
	super.write(out);

	// write only the classname to avoid Java serialization
	out.writeUTF(typeClass.getName());
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:8,代码来源:GenericTypeSerializerConfigSnapshot.java

示例8: writeStateMetaInfo

import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void writeStateMetaInfo(DataOutputView out) throws IOException {
	out.writeUTF(stateMetaInfo.getName());
	out.writeByte(stateMetaInfo.getAssignmentMode().ordinal());

	// write in a way that allows us to be fault-tolerant and skip blocks in the case of java serialization failures
	TypeSerializerSerializationUtil.writeSerializersAndConfigsWithResilience(
		out,
		Collections.singletonList(new Tuple2<TypeSerializer<?>, TypeSerializerConfigSnapshot>(
			stateMetaInfo.getPartitionStateSerializer(),
			stateMetaInfo.getPartitionStateSerializerConfigSnapshot())));
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:13,代码来源:OperatorBackendStateMetaInfoSnapshotReaderWriters.java

示例9: write

import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void write(DataOutputView out) throws IOException {
	super.write(out);
	out.writeInt(val);
	out.writeUTF(msg);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:7,代码来源:TypeSerializerConfigSnapshotTest.java

示例10: write

import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void write(DataOutputView out) throws IOException {
  super.write(out);
  out.writeUTF(coderName);
}
 
开发者ID:apache,项目名称:beam,代码行数:6,代码来源:CoderTypeSerializer.java

示例11: write

import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void write(DataOutputView out) throws IOException {
	super.write(out);
	out.writeUTF(data);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:6,代码来源:VersionedIOWriteableTest.java

示例12: write

import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void write(DataOutputView out) throws IOException {
	out.writeUTF(this.value);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:5,代码来源:AsciiStringType.java

示例13: write

import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void write(DataOutputView out) throws IOException {
	super.write(out);

	out.writeUTF(typeToInstantiate.getName());
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:7,代码来源:AvroSerializer.java

示例14: write

import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void write(DataOutputView out) throws IOException {
	out.writeUTF(this.prefix);
	this.backingConfig.write(out);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:6,代码来源:DelegatingConfiguration.java

示例15: serialize

import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
@SuppressWarnings({"unchecked", "rawtypes"})
public void serialize(T value, DataOutputView target) throws IOException {
	int flags = 0;
	// handle null values
	if (value == null) {
		flags |= IS_NULL;
		target.writeByte(flags);
		return;
	}

	Integer subclassTag = -1;
	Class<?> actualClass = value.getClass();
	TypeSerializer subclassSerializer = null;
	if (clazz != actualClass) {
		subclassTag = registeredClasses.get(actualClass);
		if (subclassTag != null) {
			flags |= IS_TAGGED_SUBCLASS;
			subclassSerializer = registeredSerializers[subclassTag];
		} else {
			flags |= IS_SUBCLASS;
			subclassSerializer = getSubclassSerializer(actualClass);
		}
	} else {
		flags |= NO_SUBCLASS;
	}

	target.writeByte(flags);

	// if its a registered subclass, write the class tag id, otherwise write the full classname
	if ((flags & IS_SUBCLASS) != 0) {
		target.writeUTF(actualClass.getName());
	} else if ((flags & IS_TAGGED_SUBCLASS) != 0) {
		target.writeByte(subclassTag);
	}

	// if its a subclass, use the corresponding subclass serializer,
	// otherwise serialize each field with our field serializers
	if ((flags & NO_SUBCLASS) != 0) {
		try {
			for (int i = 0; i < numFields; i++) {
				Object o = (fields[i] != null) ? fields[i].get(value) : null;
				if (o == null) {
					target.writeBoolean(true); // null field handling
				} else {
					target.writeBoolean(false);
					fieldSerializers[i].serialize(o, target);
				}
			}
		} catch (IllegalAccessException e) {
			throw new RuntimeException("Error during POJO copy, this should not happen since we check the fields before.", e);
		}
	} else {
		// subclass
		if (subclassSerializer != null) {
			subclassSerializer.serialize(value, target);
		}
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:60,代码来源:PojoSerializer.java


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