// Path: hive-dwrf/src/main/java/com/facebook/hive/orc/compression/CompressionCodec.java
// public interface CompressionCodec {
//   /**
//    * Compress the in buffer to the out buffer.
//    * @param in the bytes to compress
//    * @param out the uncompressed bytes
//    * @param overflow put any additional bytes here
//    * @return true if the output is smaller than input
//    * @throws IOException
//    */
//   boolean compress(ByteBuffer in, ByteBuffer out, ByteBuffer overflow
//                   ) throws IOException;
// 
//   /**
//    * Decompress the in buffer to the out buffer.
//    * @param in the bytes to decompress
//    * @param out the decompressed bytes
//    * @throws IOException
//    */
//   void decompress(ByteBuffer in, ByteBuffer out) throws IOException;
// 
//   void reloadConfigurations(Configuration conf);
// }


import com.facebook.hive.orc.OrcProto.RowIndexEntry;
import org.apache.hadoop.fs.FSDataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.util.List;
import com.facebook.hive.orc.compression.CompressionCodec;
import com.facebook.hive.orc.OrcProto.RowIndexEntry;

    @Override
    public void seek(int index) throws IOException {
      offset = (int) base + indeces[index];
    }

    @Override
    public String toString() {
      return "uncompressed stream " + name + " base: " + base +
         " offset: " + offset + " limit: " + limit;
    }

    @Override
    public int loadIndeces(List<RowIndexEntry> rowIndexEntries, int startIndex) {
      indeces = new int[rowIndexEntries.size()];
      int i = 0;
      for (RowIndexEntry rowIndexEntry : rowIndexEntries) {
        indeces[i] = (int) rowIndexEntry.getPositions(startIndex);
        i++;
      }

      return startIndex + 1;
    }
  }

  private static class CompressedStream extends InStream {
    private final String name;
    private byte[] array;
    private final int compressionBlockSize;
    private ByteBuffer uncompressed = null;
// Path: hive-dwrf/src/main/java/com/facebook/hive/orc/compression/CompressionCodec.java
// public interface CompressionCodec {
//   /**
//    * Compress the in buffer to the out buffer.
//    * @param in the bytes to compress
//    * @param out the uncompressed bytes
//    * @param overflow put any additional bytes here
//    * @return true if the output is smaller than input
//    * @throws IOException
//    */
//   boolean compress(ByteBuffer in, ByteBuffer out, ByteBuffer overflow
//                   ) throws IOException;
// 
//   /**
//    * Decompress the in buffer to the out buffer.
//    * @param in the bytes to decompress
//    * @param out the decompressed bytes
//    * @throws IOException
//    */
//   void decompress(ByteBuffer in, ByteBuffer out) throws IOException;
// 
//   void reloadConfigurations(Configuration conf);
// }


// Path: hive-dwrf/src/main/java/com/facebook/hive/orc/InStream.java
import com.facebook.hive.orc.OrcProto.RowIndexEntry;
import org.apache.hadoop.fs.FSDataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.util.List;
import com.facebook.hive.orc.compression.CompressionCodec;
import com.facebook.hive.orc.OrcProto.RowIndexEntry;


    @Override
    public void seek(int index) throws IOException {
      offset = (int) base + indeces[index];
    }

    @Override
    public String toString() {
      return "uncompressed stream " + name + " base: " + base +
         " offset: " + offset + " limit: " + limit;
    }

    @Override
    public int loadIndeces(List<RowIndexEntry> rowIndexEntries, int startIndex) {
      indeces = new int[rowIndexEntries.size()];
      int i = 0;
      for (RowIndexEntry rowIndexEntry : rowIndexEntries) {
        indeces[i] = (int) rowIndexEntry.getPositions(startIndex);
        i++;
      }

      return startIndex + 1;
    }
  }

  private static class CompressedStream extends InStream {
    private final String name;
    private byte[] array;
    private final int compressionBlockSize;
    private ByteBuffer uncompressed = null;
    private final CompressionCodec codec;