本文整理汇总了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;
}
}
}
示例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);
}
示例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);
}
}
示例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;
}
示例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);
}
}