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


Java DataInputViewStream类代码示例

本文整理汇总了Java中org.apache.flink.api.java.typeutils.runtime.DataInputViewStream的典型用法代码示例。如果您正苦于以下问题:Java DataInputViewStream类的具体用法?Java DataInputViewStream怎么用?Java DataInputViewStream使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DataInputViewStream类属于org.apache.flink.api.java.typeutils.runtime包,在下文中一共展示了DataInputViewStream类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: deserialize

import org.apache.flink.api.java.typeutils.runtime.DataInputViewStream; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public T deserialize(DataInputView source) throws IOException {
	checkKryoInitialized();
	if (source != previousIn) {
		DataInputViewStream inputStream = new DataInputViewStream(source);
		input = new NoFetchingInput(inputStream);
		previousIn = source;
	}

	try {
		return (T) kryo.readClassAndObject(input);
	} catch (KryoException ke) {
		Throwable cause = ke.getCause();

		if (cause instanceof EOFException) {
			throw (EOFException) cause;
		} else {
			throw ke;
		}
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:23,代码来源:KryoSerializer.java

示例2: restoreState

import org.apache.flink.api.java.typeutils.runtime.DataInputViewStream; //导入依赖的package包/类
@Override
public void restoreState(StreamTaskState taskState, long recoveryTimestamp) throws Exception {
	@SuppressWarnings("unchecked")
	StateHandle<DataInputView> stateHandle = (StateHandle<DataInputView>)taskState.getOperatorState();

	DataInputView input = stateHandle.getState(getUserCodeClassloader());

	ObjectInputStream ois = new ObjectInputStream(new DataInputViewStream(input));

	int numAlertEvents = ois.readInt();

	for (int i = 0; i < numAlertEvents; i++) {
		AlertEvent alertEvent = (AlertEvent)ois.readObject();
		alertEvents.add(alertEvent);
	}

	super.restoreState(taskState, recoveryTimestamp);
}
 
开发者ID:dataArtisans,项目名称:timeout-monitoring,代码行数:19,代码来源:AlertWindowOperator.java

示例3: read

import org.apache.flink.api.java.typeutils.runtime.DataInputViewStream; //导入依赖的package包/类
@Override
public void read(DataInputView in) throws IOException {
	super.read(in);

	try (final DataInputViewStream inViewWrapper = new DataInputViewStream(in)) {
		componentClass = InstantiationUtil.deserializeObject(inViewWrapper, getUserCodeClassLoader());
	} catch (ClassNotFoundException e) {
		throw new IOException("Could not find requested element class in classpath.", e);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:11,代码来源:GenericArraySerializerConfigSnapshot.java

示例4: readStateMetaInfo

import org.apache.flink.api.java.typeutils.runtime.DataInputViewStream; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public RegisteredOperatorBackendStateMetaInfo.Snapshot<S> readStateMetaInfo(DataInputView in) throws IOException {
	RegisteredOperatorBackendStateMetaInfo.Snapshot<S> stateMetaInfo =
		new RegisteredOperatorBackendStateMetaInfo.Snapshot<>();

	stateMetaInfo.setName(in.readUTF());
	stateMetaInfo.setAssignmentMode(OperatorStateHandle.Mode.values()[in.readByte()]);

	DataInputViewStream dis = new DataInputViewStream(in);
	ClassLoader previousClassLoader = Thread.currentThread().getContextClassLoader();
	try (
		TypeSerializerSerializationUtil.FailureTolerantObjectInputStream ois =
			new TypeSerializerSerializationUtil.FailureTolerantObjectInputStream(dis, userCodeClassLoader)) {

		Thread.currentThread().setContextClassLoader(userCodeClassLoader);
		TypeSerializer<S> stateSerializer = (TypeSerializer<S>) ois.readObject();
		stateMetaInfo.setPartitionStateSerializer(stateSerializer);
	} catch (ClassNotFoundException exception) {
		throw new IOException(exception);
	} finally {
		Thread.currentThread().setContextClassLoader(previousClassLoader);
	}

	// old versions do not contain the partition state serializer's configuration snapshot
	stateMetaInfo.setPartitionStateSerializerConfigSnapshot(null);

	return stateMetaInfo;
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:30,代码来源:OperatorBackendStateMetaInfoSnapshotReaderWriters.java

示例5: deserialize

import org.apache.flink.api.java.typeutils.runtime.DataInputViewStream; //导入依赖的package包/类
@Override
public T deserialize(DataInputView source) throws IOException {
	try (final DataInputViewStream inViewWrapper = new DataInputViewStream(source)) {
		return InstantiationUtil.deserializeObject(
				inViewWrapper,
				Thread.currentThread().getContextClassLoader());
	} catch (ClassNotFoundException e) {
		throw new IOException("Could not deserialize object.", e);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:11,代码来源:JavaSerializer.java


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