本文整理汇总了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();
}
示例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())));
}
示例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);
}
}
示例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());
}
}
示例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);
}
}
示例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);
}
}
示例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());
}
示例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())));
}
示例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);
}
示例10: write
import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void write(DataOutputView out) throws IOException {
super.write(out);
out.writeUTF(coderName);
}
示例11: write
import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void write(DataOutputView out) throws IOException {
super.write(out);
out.writeUTF(data);
}
示例12: write
import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void write(DataOutputView out) throws IOException {
out.writeUTF(this.value);
}
示例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());
}
示例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);
}
示例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);
}
}
}