   private class S3NFsInputStream extends FSInputStream{
 
         private AmazonS3Client s3Client;
         private Configuration configuration;
         private String bucket;
         private String key;
         private long length;
 
         private S3ObjectInputStream s3ObjectInputStream;
         private S3Object s3Object;
         private long position;
 
         public S3NFsInputStream(AmazonS3Client s3, Configuration conf, String bucket, String key, long length) {
             super();
 
             this.s3Client = s3;
             this.configuration = conf;
             this.bucket = bucket;
             this.key = key;
             this.length = length;
 
             this.s3Object = null;
 
         }
 
         private void openObject(){
 
             if(s3Object == null){
                 openS3Stream(0);
             }
 
         }
 
         private void openS3Stream(long position){
 
             if(s3ObjectInputStream != null){
                 s3ObjectInputStream.abort();
             }
 
             GetObjectRequest objectRequest = new GetObjectRequest(this.bucket, this.key);
             objectRequest.setRange(position, length - 1);
             this.s3Object = this.s3Client.getObject(objectRequest);
             this.s3ObjectInputStream = this.s3Object.getObjectContent();
 
             this.position = position;
 
         }
 
 
