streams-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smashew <...@git.apache.org>
Subject [GitHub] incubator-streams pull request: Twitter Modificaitons
Date Mon, 05 May 2014 22:03:49 GMT
Github user smashew commented on a diff in the pull request:

    https://github.com/apache/incubator-streams/pull/8#discussion_r12302402
  
    --- Diff: streams-contrib/streams-amazon-aws/streams-persist-s3/src/main/java/org/apache/streams/s3/S3PersistReaderTask.java
---
    @@ -0,0 +1,87 @@
    +package org.apache.streams.s3;
    +
    +import com.google.common.base.Strings;
    +import org.apache.streams.core.DatumStatus;
    +import org.apache.streams.core.StreamsDatum;
    +import org.slf4j.Logger;
    +import org.slf4j.LoggerFactory;
    +
    +import java.io.BufferedReader;
    +import java.io.Closeable;
    +import java.io.InputStreamReader;
    +
    +public class S3PersistReaderTask implements Runnable {
    +
    +    private static final Logger LOGGER = LoggerFactory.getLogger(S3PersistReaderTask.class);
    +
    +    private S3PersistReader reader;
    +
    +    public S3PersistReaderTask(S3PersistReader reader) {
    +        this.reader = reader;
    +    }
    +
    +    @Override
    +    public void run() {
    +
    +        for(String file : reader.getFiles())
    +        {
    +            // Create our buffered reader
    +
    +            S3ObjectInputStreamWrapper is = new S3ObjectInputStreamWrapper(reader.getAmazonS3Client().getObject(reader.getBucketName(),
file));
    +            BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(is));
    +            LOGGER.info("Reading: {} ", file);
    +
    +            String line = "";
    +            try {
    +                while((line = bufferedReader.readLine()) != null)
    +                {
    +                    if( !Strings.isNullOrEmpty(line) )
    +                    {
    +                        reader.countersCurrent.incrementAttempt();
    --- End diff --
    
    example?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message