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


Java DataOutputView.writeInt方法代码示例

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


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

示例1: serializeCondition

import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
private void serializeCondition(IterativeCondition<T> condition, DataOutputView out) throws IOException {
	out.writeBoolean(condition != null);
	if (condition != null) {
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		ObjectOutputStream oos = new ObjectOutputStream(baos);

		oos.writeObject(condition);

		oos.close();
		baos.close();

		byte[] serCondition = baos.toByteArray();
		out.writeInt(serCondition.length);
		out.write(serCondition);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:17,代码来源:NFA.java

示例2: write

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

	final KryoRegistration.SerializerDefinitionType serializerDefinitionType = kryoRegistration.getSerializerDefinitionType();

	out.writeInt(serializerDefinitionType.ordinal());
	switch (serializerDefinitionType) {
		case UNSPECIFIED:
			// nothing else to write
			break;
		case CLASS:
			out.writeUTF(kryoRegistration.getSerializerClass().getName());
			break;
		case INSTANCE:
			try (final DataOutputViewStream outViewWrapper = new DataOutputViewStream(out)) {
				InstantiationUtil.serializeObject(outViewWrapper, kryoRegistration.getSerializableSerializerInstance());
			}
			break;
		default:
			// this should not happen; adding as a guard for the future
			throw new IllegalStateException(
					"Unrecognized Kryo registration serializer definition type: " + serializerDefinitionType);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:26,代码来源:KryoRegistrationSerializerConfigSnapshot.java

示例3: writeBigInteger

import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
public static void writeBigInteger(BigInteger record, DataOutputView target) throws IOException {
	// null value support
	if (record == null) {
		target.writeInt(0);
		return;
	}
	// fast paths for 0, 1, 10
	// only reference equality is checked because equals would be too expensive
	else if (record == BigInteger.ZERO) {
		target.writeInt(1);
		return;
	}
	else if (record == BigInteger.ONE) {
		target.writeInt(2);
		return;
	}
	else if (record == BigInteger.TEN) {
		target.writeInt(3);
		return;
	}
	// default
	final byte[] bytes = record.toByteArray();
	// the length we write is offset by four, because null and short-paths for ZERO, ONE, and TEN
	target.writeInt(bytes.length + 4);
	target.write(bytes);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:27,代码来源:BigIntSerializer.java

示例4: copy

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

示例5: snapshotQueueState

import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
protected void snapshotQueueState(PriorityQueue<StreamRecord<Tuple2<String, IN>>> queue, DataOutputView dataOutputView) throws IOException {
    dataOutputView.writeInt(queue.size());
    for (StreamRecord<Tuple2<String, IN>> record : queue) {
        String streamId = record.getValue().f0;
        dataOutputView.writeUTF(streamId);
        this.getStreamRecordSerializer(streamId).serialize(record, dataOutputView);
    }
}
 
开发者ID:apache,项目名称:bahir-flink,代码行数:10,代码来源:SiddhiStreamOperator.java

示例6: serialize

import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void serialize(byte[] record, DataOutputView target) throws IOException {
  if (record == null) {
    throw new IllegalArgumentException("The record must not be null.");
  }

  final int len = record.length;
  target.writeInt(len);
  target.write(record);
}
 
开发者ID:apache,项目名称:beam,代码行数:11,代码来源:EncodedValueSerializer.java

示例7: copyInternal

import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
protected static void copyInternal(DataInputView source, DataOutputView target) throws IOException {
	int count = source.readInt();
	target.writeInt(count);

	int bytes = ELEMENT_LENGTH_IN_BYTES * count;
	target.write(source, bytes);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:8,代码来源:FloatValueArray.java

示例8: serialize

import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void serialize(String[] record, DataOutputView target) throws IOException {
	if (record == null) {
		throw new IllegalArgumentException("The record must not be null.");
	}
	
	final int len = record.length;
	target.writeInt(len);
	for (int i = 0; i < len; i++) {
		StringValue.writeString(record[i], target);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:13,代码来源:StringArraySerializer.java

示例9: copy

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

示例10: write

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

	for (int i = 0; i < position; i++) {
		out.writeByte(data[i]);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:9,代码来源:ByteValueArray.java

示例11: serialize

import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void serialize(float[] record, DataOutputView target) throws IOException {
	if (record == null) {
		throw new IllegalArgumentException("The record must not be null.");
	}
	
	final int len = record.length;
	target.writeInt(len);
	for (int i = 0; i < len; i++) {
		target.writeFloat(record[i]);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:13,代码来源:FloatPrimitiveArraySerializer.java

示例12: serialize

import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void serialize(Integer record, DataOutputView target) throws IOException {
	Assert.assertFalse(disabled);
	target.writeInt(record);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:6,代码来源:CopyOnWriteStateTableTest.java

示例13: write

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

示例14: serialize

import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void serialize(Integer record, DataOutputView target) throws IOException {
	target.writeInt(record.intValue());
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:5,代码来源:CheckpointingCustomKvStateProgram.java

示例15: write

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


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