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

The following examples show how to use org.apache.hadoop.io.file.tfile.BCFile.Reader.BlockReader. 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 File: TFile.java    From hadoop with 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 File: TFile.java    From big-c with 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 File: TFile.java    From RDFS with 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 File: TFile.java    From hadoop-gpu with 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 File: TFile.java    From hadoop with 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 File: TFile.java    From big-c with 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 File: TFile.java    From RDFS with 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 File: TFile.java    From hadoop-gpu with 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 File: TFile.java    From hadoop with Apache License 2.0 4 votes vote down vote up
BlockReader getBlockReader(int blockIndex) throws IOException {
  return readerBCF.getDataBlock(blockIndex);
}
 
Example #10
Source File: TFile.java    From big-c with Apache License 2.0 4 votes vote down vote up
BlockReader getBlockReader(int blockIndex) throws IOException {
  return readerBCF.getDataBlock(blockIndex);
}
 
Example #11
Source File: TFile.java    From RDFS with Apache License 2.0 4 votes vote down vote up
BlockReader getBlockReader(int blockIndex) throws IOException {
  return readerBCF.getDataBlock(blockIndex);
}
 
Example #12
Source File: TFile.java    From hadoop-gpu with Apache License 2.0 4 votes vote down vote up
BlockReader getBlockReader(int blockIndex) throws IOException {
  return readerBCF.getDataBlock(blockIndex);
}