@Override public void read(DataInputView in) throws IOException { super.read(in); serializationFormatIdentifier = in.readUTF(); }
@SuppressWarnings("unchecked") @Override public void read(DataInputView in) throws IOException { super.read(in); String genericTypeClassname = in.readUTF(); try { typeClass = (Class<T>) Class.forName(genericTypeClassname, true, getUserCodeClassLoader()); } catch (ClassNotFoundException e) { throw new IOException("Could not find the requested class " + genericTypeClassname + " in classpath.", e); } }
@Override public final void readSnapshot(int readVersion, DataInputView in, ClassLoader userCodeClassLoader) throws IOException { if (readVersion != ADAPTER_VERSION) { throw new IOException("Wrong/unexpected version for the TypeSerializerConfigSnapshot: " + readVersion); } serializer = TypeSerializerSerializationUtil.tryReadSerializer(in, userCodeClassLoader, true); // now delegate to the snapshots own reading code setUserCodeClassLoader(userCodeClassLoader); read(in); }
@Override public void read(DataInputView in) throws IOException { super.read(in); this.nestedSerializersAndConfigs = TypeSerializerSerializationUtil.readSerializersAndConfigsWithResilience(in, getUserCodeClassLoader()); }
@Override public void read(DataInputView in) throws IOException { super.read(in); val = in.readInt(); msg = in.readUTF(); }
/** * Deserialization path for Flink versions in [1.4, 1.6]. */ @VisibleForTesting @SuppressWarnings("deprecation") static <T> TypeSerializerSnapshot<T> deserializeV1( DataInputView in, ClassLoader cl, @Nullable TypeSerializer<T> serializer) throws IOException { TypeSerializerSnapshot<T> snapshot = readAndInstantiateSnapshotClass(in, cl); // if the snapshot was created before Flink 1.7, we need to distinguish the following cases: // - old snapshot type that needs serializer from the outside // - new snapshot type that understands the old format and can produce a restore serializer from it if (snapshot instanceof TypeSerializerConfigSnapshot) { TypeSerializerConfigSnapshot<T> oldTypeSnapshot = (TypeSerializerConfigSnapshot<T>) snapshot; oldTypeSnapshot.setPriorSerializer(serializer); oldTypeSnapshot.setUserCodeClassLoader(cl); oldTypeSnapshot.read(in); } else { // new type, simple case int readVersion = in.readInt(); snapshot.readSnapshot(readVersion, in, cl); } return snapshot; }
@Override public void read(DataInputView in) throws IOException { super.read(in); serializationFormatIdentifier = in.readUTF(); }
@Override public void read(DataInputView in) throws IOException { super.read(in); this.coderName = in.readUTF(); }
@Override public void read(DataInputView in) throws IOException { super.read(in); serializationFormatIdentifier = in.readUTF(); }
@Override public void read(DataInputView in) throws IOException { super.read(in); this.coderName = in.readUTF(); }
@Override public void read(DataInputView in) throws IOException { super.read(in); this.schemaString = in.readUTF(); }
@Override public void read(DataInputView in) throws IOException { super.read(in); this.coderName = in.readUTF(); }
@SuppressWarnings("unchecked") @Override public void read(DataInputView in) throws IOException { super.read(in); String genericTypeClassname = in.readUTF(); try { typeClass = (Class<T>) Class.forName(genericTypeClassname, true, getUserCodeClassLoader()); } catch (ClassNotFoundException e) { throw new IOException("Could not find the requested class " + genericTypeClassname + " in classpath.", e); } }
@SuppressWarnings("unchecked") @Override public void read(DataInputView in) throws IOException { super.read(in); String genericTypeClassname = in.readUTF(); try { typeClass = (Class<T>) Class.forName(genericTypeClassname, true, getUserCodeClassLoader()); } catch (ClassNotFoundException e) { throw new IOException("Could not find the requested class " + genericTypeClassname + " in classpath.", e); } }
@Override public final void readSnapshot(int readVersion, DataInputView in, ClassLoader userCodeClassLoader) throws IOException { if (readVersion != ADAPTER_VERSION) { throw new IOException("Wrong/unexpected version for the TypeSerializerConfigSnapshot: " + readVersion); } serializer = TypeSerializerSerializationUtil.tryReadSerializer(in, userCodeClassLoader, true); // now delegate to the snapshots own reading code setUserCodeClassLoader(userCodeClassLoader); read(in); }
@Override public void read(DataInputView in) throws IOException { super.read(in); this.nestedSerializersAndConfigs = TypeSerializerSerializationUtil.readSerializersAndConfigsWithResilience(in, getUserCodeClassLoader()); }
@Override public void read(DataInputView in) throws IOException { super.read(in); this.nestedSerializersAndConfigs = TypeSerializerSerializationUtil.readSerializersAndConfigsWithResilience(in, getUserCodeClassLoader()); }
private void testWriteAndReadConfigSnapshot(Coder<String> coder) throws IOException { CoderTypeSerializer<String> serializer = new CoderTypeSerializer<>(coder); TypeSerializerConfigSnapshot writtenSnapshot = serializer.snapshotConfiguration(); ComparatorTestBase.TestOutputView outView = new ComparatorTestBase.TestOutputView(); writtenSnapshot.write(outView); TypeSerializerConfigSnapshot readSnapshot = new CoderTypeSerializerConfigSnapshot<>(); readSnapshot.read(outView.getInputView()); assertThat(readSnapshot, is(writtenSnapshot)); } }
private void testWriteAndReadConfigSnapshot(Coder<String> coder) throws IOException { CoderTypeSerializer<String> serializer = new CoderTypeSerializer<>(coder); TypeSerializerConfigSnapshot writtenSnapshot = serializer.snapshotConfiguration(); ComparatorTestBase.TestOutputView outView = new ComparatorTestBase.TestOutputView(); writtenSnapshot.write(outView); TypeSerializerConfigSnapshot readSnapshot = new CoderTypeSerializerConfigSnapshot<>(); readSnapshot.read(outView.getInputView()); assertThat(readSnapshot, is(writtenSnapshot)); } }
private void testWriteAndReadConfigSnapshot(Coder<String> coder) throws IOException { CoderTypeSerializer<String> serializer = new CoderTypeSerializer<>(coder); TypeSerializerConfigSnapshot writtenSnapshot = serializer.snapshotConfiguration(); ComparatorTestBase.TestOutputView outView = new ComparatorTestBase.TestOutputView(); writtenSnapshot.write(outView); TypeSerializerConfigSnapshot readSnapshot = new CoderTypeSerializerConfigSnapshot<>(); readSnapshot.read(outView.getInputView()); assertThat(readSnapshot, is(writtenSnapshot)); } }