@Test public void testText() { List<String> inputLines = Lines.resources("testdata/decode-pubsub-messages/input-*"); PCollection<String> result = pipeline .apply(Create.of(inputLines)) .apply(InputFileFormat.text.decode()) .apply(OutputFileFormat.text.encode()); PAssert.that(result).containsInAnyOrder(inputLines); pipeline.run(); }
public static PTransform<PCollection<? extends String>, PCollection<PubsubMessage>> text() { return PTransform.compose("DecodePubsubMessages.Text", input -> input.apply(MapElements.into(TypeDescriptor.of(PubsubMessage.class)) .via((String s) -> new PubsubMessage(s.getBytes(StandardCharsets.UTF_8), null)))); }
DecodePubsubMessages { public static PTransform<PCollection<? extends String>, PCollection<PubsubMessage>> text() { return PTransform.compose("DecodePubsubMessages.Text", input -> input.apply(MapElements.into(TypeDescriptor.of(PubsubMessage.class)) .via((String s) -> new PubsubMessage(s.getBytes(StandardCharsets.UTF_8), null)))); } }
DecodePubsubMessages { public static PTransform<PCollection<? extends String>, PCollection<PubsubMessage>> text() { return PTransform.compose("DecodePubsubMessages.Text", input -> input.apply(MapElements.into(TypeDescriptor.of(PubsubMessage.class)) .via((String s) -> new PubsubMessage(s.getBytes(StandardCharsets.UTF_8), null)))); }  }
DecodePubsubMessages { public static PTransform<PCollection<? extends String>, PCollection<PubsubMessage>> text() { return PTransform.compose("DecodePubsubMessages.Text", input -> input.apply(MapElements.into(TypeDescriptor.of(PubsubMessage.class)) .via((String s) -> new PubsubMessage(s.getBytes(StandardCharsets.UTF_8), null)))); }  static PTransform<PCollection<? extends String>, PCollection<PubsubMessage>> text(); static PTransform<PCollection<? extends String>, PCollection<PubsubMessage>> json(); }
DecodePubsubMessages { public static PTransform<PCollection<? extends String>, PCollection<PubsubMessage>> text() { return PTransform.compose("DecodePubsubMessages.Text", input -> input.apply(MapElements.into(TypeDescriptor.of(PubsubMessage.class)) .via((String s) -> new PubsubMessage(s.getBytes(StandardCharsets.UTF_8), null)))); }  static PTransform<PCollection<? extends String>, PCollection<PubsubMessage>> text(); static PTransform<PCollection<? extends String>, PCollection<PubsubMessage>> json();  }