diff --git a/external/storm-hdfs/src/main/java/org/apache/storm/hdfs/spout/ZippedTextFileReader.java b/external/storm-hdfs/src/main/java/org/apache/storm/hdfs/spout/ZippedTextFileReader.java
new file mode 100644
index 00000000000..71d90877436
--- /dev/null
+++ b/external/storm-hdfs/src/main/java/org/apache/storm/hdfs/spout/ZippedTextFileReader.java
@@ -0,0 +1,330 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.storm.hdfs.spout;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.hadoop.fs.FSDataInputStream;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.storm.hdfs.spout.AbstractFileReader;
+import org.apache.storm.hdfs.spout.FileOffset;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+// Todo: Track file offsets instead of line number
+public class ZippedTextFileReader extends AbstractFileReader {
+ public static final String[] defaultFields = { "line" };
+ public static final String CHARSET = "hdfsspout.reader.charset";
+ public static final String BUFFER_SIZE = "hdfsspout.reader.buffer.bytes";
+ public static Map config = null;
+ FSDataInputStream fsin = null;
+ private static final int DEFAULT_BUFF_SIZE = 4096;
+ private String zipEntryName; // Entry filename in current zipfile
+ private String zipFilename;
+ private BufferedReader reader;
+ private ZipInputStream zip = null;
+ private final Logger LOG = LoggerFactory.getLogger(ZippedTextFileReader.class);
+ private ZippedTextFileReader.Offset offset;
+
+ public ZippedTextFileReader(FileSystem fs, Path file, Map conf) throws IOException {
+ this(fs, file, conf, new ZippedTextFileReader.Offset("",0, 0));
+ }
+
+ public ZippedTextFileReader(FileSystem fs, Path file, Map conf, String startOffset) throws IOException {
+ this(fs, file, conf, new ZippedTextFileReader.Offset(startOffset));
+ }
+
+ protected ZippedTextFileReader(FileSystem fs, Path file, Map conf, ZippedTextFileReader.Offset startOffset)
+ throws IOException {
+
+ super(fs, file);
+ offset = startOffset;
+ fsin = fs.open(file);
+ zip = new ZipInputStream(fsin);
+ if (reader == null) {
+ ZipEntry entry;
+ // If there are no more zip entries it means end of zip.
+ if ((entry = zip.getNextEntry()) == null) {
+ return;
+ }
+ zipEntryName = entry.getName();
+ String fileName = offset.fileName;
+ if(StringUtils.isNotBlank(fileName)){
+ while(!fileName.equals(zipEntryName)){
+ entry = zip.getNextEntry();
+ if(entry== null){
+ throw new RuntimeException(fileName +" Not found in "+file);
+ }
+ zipEntryName = entry.getName();
+ }
+ } else {
+ offset.fileName=zipEntryName;
+ }
+ LOG.info("zipEntryName: ============:" + zipEntryName);
+ // Get current position for updating progress
+ String charSet = conf == null || !conf.containsKey(CHARSET) ? "UTF-8" : conf.get(CHARSET).toString();
+ int buffSz = conf == null || !conf.containsKey(BUFFER_SIZE) ? DEFAULT_BUFF_SIZE
+ : Integer.parseInt(conf.get(BUFFER_SIZE).toString());
+ reader = new BufferedReader(new InputStreamReader(zip, charSet), buffSz);
+ if(offset.charOffset >0) {
+ reader.skip(offset.charOffset);
+ }
+ }
+
+ }
+
+ public void initialize(Map conf,ZippedTextFileReader.Offset startOffset) throws IOException {
+ offset = startOffset;
+ String charSet = conf == null || !conf.containsKey(CHARSET) ? "UTF-8" : conf.get(CHARSET).toString();
+ int buffSz = conf == null || !conf.containsKey(BUFFER_SIZE) ? DEFAULT_BUFF_SIZE
+ : Integer.parseInt(conf.get(BUFFER_SIZE).toString());
+ reader = new BufferedReader(new InputStreamReader(zip, charSet), buffSz);
+ if(offset.charOffset >0) {
+ reader.skip(offset.charOffset);
+ }
+ }
+
+ @Override
+ public Offset getFileOffset() {
+ return offset.clone();
+ }
+
+ @Override
+ public List