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


Java DataOutputView.writeBoolean方法代码示例

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


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

示例1: serialize

import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void serialize(
		State<TXN, CONTEXT> record,
		DataOutputView target) throws IOException {
	final TransactionHolder<TXN> pendingTransaction = record.getPendingTransaction();
	transactionSerializer.serialize(pendingTransaction.handle, target);
	target.writeLong(pendingTransaction.transactionStartTime);

	final List<TransactionHolder<TXN>> pendingCommitTransactions = record.getPendingCommitTransactions();
	target.writeInt(pendingCommitTransactions.size());
	for (TransactionHolder<TXN> pendingTxn : pendingCommitTransactions) {
		transactionSerializer.serialize(pendingTxn.handle, target);
		target.writeLong(pendingTxn.transactionStartTime);
	}

	Optional<CONTEXT> context = record.getContext();
	if (context.isPresent()) {
		target.writeBoolean(true);
		contextSerializer.serialize(context.get(), target);
	} else {
		target.writeBoolean(false);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:24,代码来源:TwoPhaseCommitSinkFunction.java

示例2: 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) {
		keySerializer.copy(source, target);
		
		boolean isNull = source.readBoolean();
		target.writeBoolean(isNull);
		
		if (!isNull) {
			valueSerializer.copy(source, target);
		}
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:17,代码来源:MapSerializer.java

示例3: copy

import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void copy(
		DataInputView source, DataOutputView target) throws IOException {
	TXN pendingTxnHandle = transactionSerializer.deserialize(source);
	transactionSerializer.serialize(pendingTxnHandle, target);
	final long pendingTxnStartTime = source.readLong();
	target.writeLong(pendingTxnStartTime);

	int numPendingCommitTxns = source.readInt();
	target.writeInt(numPendingCommitTxns);
	for (int i = 0; i < numPendingCommitTxns; i++) {
		TXN pendingCommitTxnHandle = transactionSerializer.deserialize(source);
		transactionSerializer.serialize(pendingCommitTxnHandle, target);
		final long pendingCommitTxnStartTime = source.readLong();
		target.writeLong(pendingCommitTxnStartTime);
	}

	boolean hasContext = source.readBoolean();
	target.writeBoolean(hasContext);
	if (hasContext) {
		CONTEXT context = contextSerializer.deserialize(source);
		contextSerializer.serialize(context, target);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:25,代码来源:TwoPhaseCommitSinkFunction.java

示例4: serialize

import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void serialize(HashMap<K, V> map, DataOutputView target) throws IOException {
	final int size = map.size();
	target.writeInt(size);

	for (Map.Entry<K, V> entry : map.entrySet()) {
		keySerializer.serialize(entry.getKey(), target);

		if (entry.getValue() == null) {
			target.writeBoolean(true);
		} else {
			target.writeBoolean(false);
			valueSerializer.serialize(entry.getValue(), target);
		}
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:17,代码来源:HashMapSerializer.java

示例5: 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

示例6: copy

import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void copy(
		DataInputView source, DataOutputView target) throws IOException {
	boolean hasTransactionalId = source.readBoolean();
	target.writeBoolean(hasTransactionalId);
	if (hasTransactionalId) {
		target.writeUTF(source.readUTF());
	}
	target.writeLong(source.readLong());
	target.writeShort(source.readShort());
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:12,代码来源:FlinkKafkaProducer011.java

示例7: serialize

import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void serialize(Either<L, R> record, DataOutputView target) throws IOException {
	if (record.isLeft()) {
		target.writeBoolean(true);
		leftSerializer.serialize(record.left(), target);
	}
	else {
		target.writeBoolean(false);
		rightSerializer.serialize(record.right(), target);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:12,代码来源:EitherSerializer.java

示例8: copy

import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void copy(DataInputView source, DataOutputView target) throws IOException {
	boolean isLeft = source.readBoolean();
	target.writeBoolean(isLeft);
	if (isLeft) {
		leftSerializer.copy(source, target);
	}
	else {
		rightSerializer.copy(source, target);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:12,代码来源:EitherSerializer.java

示例9: serialize

import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void serialize(boolean[] 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.writeBoolean(record[i]);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:13,代码来源:BooleanPrimitiveArraySerializer.java

示例10: write

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

示例11: serialize

import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void serialize(C[] value, DataOutputView target) throws IOException {
	target.writeInt(value.length);
	for (int i = 0; i < value.length; i++) {
		C val = value[i];
		if (val == null) {
			target.writeBoolean(false);
		} else {
			target.writeBoolean(true);
			componentSerializer.serialize(val, target);
		}
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:14,代码来源:GenericArraySerializer.java

示例12: write

import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void write(DataOutputView out) throws IOException {
	if (uri == null) {
		out.writeBoolean(false);
	} else {
		out.writeBoolean(true);
		StringUtils.writeNullableString(uri.getScheme(), out);
		StringUtils.writeNullableString(uri.getUserInfo(), out);
		StringUtils.writeNullableString(uri.getHost(), out);
		out.writeInt(uri.getPort());
		StringUtils.writeNullableString(uri.getPath(), out);
		StringUtils.writeNullableString(uri.getQuery(), out);
		StringUtils.writeNullableString(uri.getFragment(), out);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:16,代码来源:Path.java

示例13: 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

示例14: copy

import org.apache.flink.core.memory.DataOutputView; //导入方法依赖的package包/类
@Override
public void copy(DataInputView source, DataOutputView target) throws IOException {
	// copy the flags
	int flags = source.readByte();
	target.writeByte(flags);

	if ((flags & IS_NULL) != 0) {
		// is a null value, nothing further to copy
		return;
	}

	TypeSerializer<?> subclassSerializer = null;
	if ((flags & IS_SUBCLASS) != 0) {
		String className = source.readUTF();
		target.writeUTF(className);
		try {
			Class<?> subclass = Class.forName(className, true, Thread.currentThread()
					.getContextClassLoader());
			subclassSerializer = getSubclassSerializer(subclass);
		} catch (ClassNotFoundException e) {
			throw new RuntimeException("Cannot instantiate class.", e);
		}
	} else if ((flags & IS_TAGGED_SUBCLASS) != 0) {
		int subclassTag = source.readByte();
		target.writeByte(subclassTag);
		subclassSerializer = registeredSerializers[subclassTag];
	}

	if ((flags & NO_SUBCLASS) != 0) {
		for (int i = 0; i < numFields; i++) {
			boolean isNull = source.readBoolean();
			target.writeBoolean(isNull);
			if (!isNull) {
				fieldSerializers[i].copy(source, target);
			}
		}
	} else {
		if (subclassSerializer != null) {
			subclassSerializer.copy(source, target);
		}
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:43,代码来源:PojoSerializer.java

示例15: copy

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


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