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


Java DataInputView.readBoolean方法代码示例

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


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

示例1: copy

import org.apache.flink.core.memory.DataInputView; //导入方法依赖的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,代码来源:HashMapSerializer.java

示例2: copy

import org.apache.flink.core.memory.DataInputView; //导入方法依赖的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

示例3: deserialize

import org.apache.flink.core.memory.DataInputView; //导入方法依赖的package包/类
@Override
public Map<K, V> deserialize(DataInputView source) throws IOException {
	final int size = source.readInt();

	final Map<K, V> map = new HashMap<>(size);
	for (int i = 0; i < size; ++i) {
		K key = keySerializer.deserialize(source);

		boolean isNull = source.readBoolean();
		V value = isNull ? null : valueSerializer.deserialize(source);

		map.put(key, value);
	}

	return map;
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:17,代码来源:MapSerializer.java

示例4: deserializeCondition

import org.apache.flink.core.memory.DataInputView; //导入方法依赖的package包/类
private IterativeCondition<T> deserializeCondition(DataInputView in) throws IOException, ClassNotFoundException {
	boolean hasCondition = in.readBoolean();
	if (hasCondition) {
		int length = in.readInt();

		byte[] serCondition = new byte[length];
		in.read(serCondition);

		ByteArrayInputStream bais = new ByteArrayInputStream(serCondition);
		ObjectInputStream ois = new ObjectInputStream(bais);

		IterativeCondition<T> condition = (IterativeCondition<T>) ois.readObject();
		ois.close();
		bais.close();

		return condition;
	}
	return null;
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:20,代码来源:NFA.java

示例5: deserialize

import org.apache.flink.core.memory.DataInputView; //导入方法依赖的package包/类
@Override
public HashMap<K, V> deserialize(DataInputView source) throws IOException {
	final int size = source.readInt();

	final HashMap<K, V> map = new HashMap<>(size);
	for (int i = 0; i < size; ++i) {
		K key = keySerializer.deserialize(source);

		boolean isNull = source.readBoolean();
		V value = isNull ? null : valueSerializer.deserialize(source);

		map.put(key, value);
	}

	return map;
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:17,代码来源:HashMapSerializer.java

示例6: deserialize

import org.apache.flink.core.memory.DataInputView; //导入方法依赖的package包/类
@Override
public State<TXN, CONTEXT> deserialize(DataInputView source) throws IOException {
	TXN pendingTxnHandle = transactionSerializer.deserialize(source);
	final long pendingTxnStartTime = source.readLong();
	final TransactionHolder<TXN> pendingTxn = new TransactionHolder<>(
		pendingTxnHandle,
		pendingTxnStartTime);

	int numPendingCommitTxns = source.readInt();
	List<TransactionHolder<TXN>> pendingCommitTxns = new ArrayList<>(numPendingCommitTxns);
	for (int i = 0; i < numPendingCommitTxns; i++) {
		final TXN pendingCommitTxnHandle = transactionSerializer.deserialize(source);
		final long pendingCommitTxnStartTime = source.readLong();
		pendingCommitTxns.add(new TransactionHolder<>(
			pendingCommitTxnHandle,
			pendingCommitTxnStartTime));
	}

	Optional<CONTEXT> context = Optional.empty();
	boolean hasContext = source.readBoolean();
	if (hasContext) {
		context = Optional.of(contextSerializer.deserialize(source));
	}

	return new State<>(pendingTxn, pendingCommitTxns, context);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:27,代码来源:TwoPhaseCommitSinkFunction.java

示例7: copy

import org.apache.flink.core.memory.DataInputView; //导入方法依赖的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

示例8: read

import org.apache.flink.core.memory.DataInputView; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void read(DataInputView in) throws IOException {
	super.read(in);

	final int readVersion = getReadVersion();

	if (readVersion >= 4) {
		usingKeyGroupCompression = in.readBoolean();
	} else {
		usingKeyGroupCompression = false;
	}

	// only starting from version 3, we have the key serializer and its config snapshot written
	if (readVersion >= 3) {
		Tuple2<TypeSerializer<?>, TypeSerializerConfigSnapshot> keySerializerAndConfig =
				TypeSerializerSerializationUtil.readSerializersAndConfigsWithResilience(in, userCodeClassLoader).get(0);
		this.keySerializer = (TypeSerializer<K>) keySerializerAndConfig.f0;
		this.keySerializerConfigSnapshot = keySerializerAndConfig.f1;
	} else {
		this.keySerializer = TypeSerializerSerializationUtil.tryReadSerializer(in, userCodeClassLoader);
		this.keySerializerConfigSnapshot = null;
	}

	int numKvStates = in.readShort();
	stateMetaInfoSnapshots = new ArrayList<>(numKvStates);
	for (int i = 0; i < numKvStates; i++) {
		stateMetaInfoSnapshots.add(
			KeyedBackendStateMetaInfoSnapshotReaderWriters
				.getReaderForVersion(getReadVersion(), userCodeClassLoader)
				.readStateMetaInfo(in));
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:34,代码来源:KeyedBackendSerializationProxy.java

示例9: copy

import org.apache.flink.core.memory.DataInputView; //导入方法依赖的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

示例10: compareSerialized

import org.apache.flink.core.memory.DataInputView; //导入方法依赖的package包/类
@Override
public int compareSerialized(DataInputView firstSource, DataInputView secondSource) throws IOException {
	final int fs = firstSource.readBoolean() ? 1 : 0;
	final int ss = secondSource.readBoolean() ? 1 : 0;
	int comp = fs - ss; 
	return ascendingComparison ? comp : -comp; 
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:8,代码来源:BooleanComparator.java

示例11: copy

import org.apache.flink.core.memory.DataInputView; //导入方法依赖的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

示例12: deserialize

import org.apache.flink.core.memory.DataInputView; //导入方法依赖的package包/类
/**
 * Deserializes an object from the input view.
 *
 * <p>First it reads a boolean indicating whether a reference handle or a serialized object
 * follows.
 *
 * @param source The input view from which to read the data.
 * @return The deserialized object
 * @throws IOException
 */
public T deserialize(DataInputView source) throws IOException {
	boolean alreadyRead = source.readBoolean();

	if (alreadyRead) {
		int index = source.readInt();
		return elementList.get(index);
	} else {
		T element = typeSerializer.deserialize(source);
		elementList.add(element);

		return element;
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:24,代码来源:NonDuplicatingTypeSerializer.java

示例13: copy

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

	if (alreadyRead) {
		int index = source.readInt();
		typeSerializer.serialize(elementList.get(index), target);
	} else {
		T element = typeSerializer.deserialize(source);
		typeSerializer.serialize(element, target);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:13,代码来源:NonDuplicatingTypeSerializer.java

示例14: copy

import org.apache.flink.core.memory.DataInputView; //导入方法依赖的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: read

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


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