damondouglas commented on PR #28502:
URL: https://github.com/apache/beam/pull/28502#issuecomment-1734187154

   > Hello, @damondouglas. I really appreciate for your review and your 
suggestion. I have a question about your suggestion.
   > 
   > As far as I understand, even though I found every occurrences of 
`readFullyAsUTF8String()`, I think that there is no relationship between 
`readFullyAsUTF8String()` method and reading `TextSource` or `FileBasedSource`. 
Could you explain where can I find connection between them?
   
   Hello @gudfhr95, It's nice to hear from you and thank you for your response. 
I just created this example gist that uses `FileIO.ReadableFile`'s 
[readFullyAsUTF8String](https://beam.apache.org/releases/javadoc/current/org/apache/beam/sdk/io/FileIO.ReadableFile.html#readFullyAsUTF8String--)
 method. In the gist, I performed the line skipping in a DoFn as copied from 
the gist below.
   
   ```
   @ProcessElement
   public void process(@Element ReadableFile element) {
           String rawData = element.readFullyAsUTF8String();
           Stream<String> lines = rawData.lines().skip(/* int */ skipLines);
           List<String> result = lines.collect(Collectors.toList());
   }
   ```
   
   https://gist.github.com/damondouglas/84c34469d4a6d7b7483468659482855c
   
   However, I can see this code in a new `readFullyAsUTF8String` method that 
takes an `int skipLines` argument. So the above DoFn could look like this:
   
   ```
   @ProcessElement
   public void process(@Element ReadableFile element) {
           List<String> lines = element.readFullyAsUTF8String(/* int */ 
skipLines);
   }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to