Java Code Examples for org.apache.hadoop.io.file.tfile.BCFile.Reader.BlockReader

The following examples show how to use org.apache.hadoop.io.file.tfile.BCFile.Reader.BlockReader. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: hadoop   Source File: TFile.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Constructor
 * 
 * @param fsdis
 *          FS input stream of the TFile.
 * @param fileLength
 *          The length of TFile. This is required because we have no easy
 *          way of knowing the actual size of the input file through the
 *          File input stream.
 * @param conf
 * @throws IOException
 */
public Reader(FSDataInputStream fsdis, long fileLength, Configuration conf)
    throws IOException {
  readerBCF = new BCFile.Reader(fsdis, fileLength, conf);

  // first, read TFile meta
  BlockReader brMeta = readerBCF.getMetaBlock(TFileMeta.BLOCK_NAME);
  try {
    tfileMeta = new TFileMeta(brMeta);
  } finally {
    brMeta.close();
  }

  comparator = tfileMeta.getComparator();
  // Set begin and end locations.
  begin = new Location(0, 0);
  end = new Location(readerBCF.getBlockCount(), 0);
}
 
Example 2
Source Project: big-c   Source File: TFile.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Constructor
 * 
 * @param fsdis
 *          FS input stream of the TFile.
 * @param fileLength
 *          The length of TFile. This is required because we have no easy
 *          way of knowing the actual size of the input file through the
 *          File input stream.
 * @param conf
 * @throws IOException
 */
public Reader(FSDataInputStream fsdis, long fileLength, Configuration conf)
    throws IOException {
  readerBCF = new BCFile.Reader(fsdis, fileLength, conf);

  // first, read TFile meta
  BlockReader brMeta = readerBCF.getMetaBlock(TFileMeta.BLOCK_NAME);
  try {
    tfileMeta = new TFileMeta(brMeta);
  } finally {
    brMeta.close();
  }

  comparator = tfileMeta.getComparator();
  // Set begin and end locations.
  begin = new Location(0, 0);
  end = new Location(readerBCF.getBlockCount(), 0);
}
 
Example 3
Source Project: RDFS   Source File: TFile.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Constructor
 * 
 * @param fsdis
 *          FS input stream of the TFile.
 * @param fileLength
 *          The length of TFile. This is required because we have no easy
 *          way of knowing the actual size of the input file through the
 *          File input stream.
 * @param conf
 * @throws IOException
 */
public Reader(FSDataInputStream fsdis, long fileLength, Configuration conf)
    throws IOException {
  readerBCF = new BCFile.Reader(fsdis, fileLength, conf);

  // first, read TFile meta
  BlockReader brMeta = readerBCF.getMetaBlock(TFileMeta.BLOCK_NAME);
  try {
    tfileMeta = new TFileMeta(brMeta);
  } finally {
    brMeta.close();
  }

  comparator = tfileMeta.getComparator();
  // Set begin and end locations.
  begin = new Location(0, 0);
  end = new Location(readerBCF.getBlockCount(), 0);
}
 
Example 4
Source Project: hadoop-gpu   Source File: TFile.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Constructor
 * 
 * @param fsdis
 *          FS input stream of the TFile.
 * @param fileLength
 *          The length of TFile. This is required because we have no easy
 *          way of knowing the actual size of the input file through the
 *          File input stream.
 * @param conf
 * @throws IOException
 */
public Reader(FSDataInputStream fsdis, long fileLength, Configuration conf)
    throws IOException {
  readerBCF = new BCFile.Reader(fsdis, fileLength, conf);

  // first, read TFile meta
  BlockReader brMeta = readerBCF.getMetaBlock(TFileMeta.BLOCK_NAME);
  try {
    tfileMeta = new TFileMeta(brMeta);
  } finally {
    brMeta.close();
  }

  comparator = tfileMeta.getComparator();
  // Set begin and end locations.
  begin = new Location(0, 0);
  end = new Location(readerBCF.getBlockCount(), 0);
}
 
Example 5
Source Project: hadoop   Source File: TFile.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Lazily loading the TFile index.
 * 
 * @throws IOException
 */
synchronized void checkTFileDataIndex() throws IOException {
  if (tfileIndex == null) {
    BlockReader brIndex = readerBCF.getMetaBlock(TFileIndex.BLOCK_NAME);
    try {
      tfileIndex =
          new TFileIndex(readerBCF.getBlockCount(), brIndex, tfileMeta
              .getComparator());
    } finally {
      brIndex.close();
    }
  }
}
 
Example 6
Source Project: big-c   Source File: TFile.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Lazily loading the TFile index.
 * 
 * @throws IOException
 */
synchronized void checkTFileDataIndex() throws IOException {
  if (tfileIndex == null) {
    BlockReader brIndex = readerBCF.getMetaBlock(TFileIndex.BLOCK_NAME);
    try {
      tfileIndex =
          new TFileIndex(readerBCF.getBlockCount(), brIndex, tfileMeta
              .getComparator());
    } finally {
      brIndex.close();
    }
  }
}
 
Example 7
Source Project: RDFS   Source File: TFile.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Lazily loading the TFile index.
 * 
 * @throws IOException
 */
synchronized void checkTFileDataIndex() throws IOException {
  if (tfileIndex == null) {
    BlockReader brIndex = readerBCF.getMetaBlock(TFileIndex.BLOCK_NAME);
    try {
      tfileIndex =
          new TFileIndex(readerBCF.getBlockCount(), brIndex, tfileMeta
              .getComparator());
    } finally {
      brIndex.close();
    }
  }
}
 
Example 8
Source Project: hadoop-gpu   Source File: TFile.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Lazily loading the TFile index.
 * 
 * @throws IOException
 */
synchronized void checkTFileDataIndex() throws IOException {
  if (tfileIndex == null) {
    BlockReader brIndex = readerBCF.getMetaBlock(TFileIndex.BLOCK_NAME);
    try {
      tfileIndex =
          new TFileIndex(readerBCF.getBlockCount(), brIndex, tfileMeta
              .getComparator());
    } finally {
      brIndex.close();
    }
  }
}
 
Example 9
Source Project: hadoop   Source File: TFile.java    License: Apache License 2.0 4 votes vote down vote up
BlockReader getBlockReader(int blockIndex) throws IOException {
  return readerBCF.getDataBlock(blockIndex);
}
 
Example 10
Source Project: big-c   Source File: TFile.java    License: Apache License 2.0 4 votes vote down vote up
BlockReader getBlockReader(int blockIndex) throws IOException {
  return readerBCF.getDataBlock(blockIndex);
}
 
Example 11
Source Project: RDFS   Source File: TFile.java    License: Apache License 2.0 4 votes vote down vote up
BlockReader getBlockReader(int blockIndex) throws IOException {
  return readerBCF.getDataBlock(blockIndex);
}
 
Example 12
Source Project: hadoop-gpu   Source File: TFile.java    License: Apache License 2.0 4 votes vote down vote up
BlockReader getBlockReader(int blockIndex) throws IOException {
  return readerBCF.getDataBlock(blockIndex);
}