Java Code Examples for org.apache.hadoop.io.file.tfile.Utils.Version

The following examples show how to use org.apache.hadoop.io.file.tfile.Utils.Version. 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 5 votes vote down vote up
public TFileMeta(DataInput in) throws IOException {
  version = new Version(in);
  if (!version.compatibleWith(TFile.API_VERSION)) {
    throw new RuntimeException("Incompatible TFile fileVersion.");
  }
  recordCount = Utils.readVLong(in);
  strComparator = Utils.readString(in);
  comparator = makeComparator(strComparator);
}
 
Example 2
Source Project: hadoop   Source File: BCFile.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Constructor
 * 
 * @param fin
 *          FS input stream.
 * @param fileLength
 *          Length of the corresponding file
 * @throws IOException
 */
public Reader(FSDataInputStream fin, long fileLength, Configuration conf)
    throws IOException {
  this.in = fin;
  this.conf = conf;

  // move the cursor to the beginning of the tail, containing: offset to the
  // meta block index, version and magic
  fin.seek(fileLength - Magic.size() - Version.size() - Long.SIZE
      / Byte.SIZE);
  long offsetIndexMeta = fin.readLong();
  version = new Version(fin);
  Magic.readAndVerify(fin);

  if (!version.compatibleWith(BCFile.API_VERSION)) {
    throw new RuntimeException("Incompatible BCFile fileBCFileVersion.");
  }

  // read meta index
  fin.seek(offsetIndexMeta);
  metaIndex = new MetaIndex(fin);

  // read data:BCFile.index, the data block index
  BlockReader blockR = getMetaBlock(DataIndex.BLOCK_NAME);
  try {
    dataIndex = new DataIndex(blockR);
  } finally {
    blockR.close();
  }
}
 
Example 3
Source Project: big-c   Source File: TFile.java    License: Apache License 2.0 5 votes vote down vote up
public TFileMeta(DataInput in) throws IOException {
  version = new Version(in);
  if (!version.compatibleWith(TFile.API_VERSION)) {
    throw new RuntimeException("Incompatible TFile fileVersion.");
  }
  recordCount = Utils.readVLong(in);
  strComparator = Utils.readString(in);
  comparator = makeComparator(strComparator);
}
 
Example 4
Source Project: big-c   Source File: BCFile.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Constructor
 * 
 * @param fin
 *          FS input stream.
 * @param fileLength
 *          Length of the corresponding file
 * @throws IOException
 */
public Reader(FSDataInputStream fin, long fileLength, Configuration conf)
    throws IOException {
  this.in = fin;
  this.conf = conf;

  // move the cursor to the beginning of the tail, containing: offset to the
  // meta block index, version and magic
  fin.seek(fileLength - Magic.size() - Version.size() - Long.SIZE
      / Byte.SIZE);
  long offsetIndexMeta = fin.readLong();
  version = new Version(fin);
  Magic.readAndVerify(fin);

  if (!version.compatibleWith(BCFile.API_VERSION)) {
    throw new RuntimeException("Incompatible BCFile fileBCFileVersion.");
  }

  // read meta index
  fin.seek(offsetIndexMeta);
  metaIndex = new MetaIndex(fin);

  // read data:BCFile.index, the data block index
  BlockReader blockR = getMetaBlock(DataIndex.BLOCK_NAME);
  try {
    dataIndex = new DataIndex(blockR);
  } finally {
    blockR.close();
  }
}
 
Example 5
Source Project: attic-apex-malhar   Source File: DTBCFile.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Constructor
 *
 * @param fin
 *          FS input stream.
 * @param fileLength
 *          Length of the corresponding file
 * @throws IOException
 */
public Reader(FSDataInputStream fin, long fileLength, Configuration conf)
    throws IOException {
  this.in = fin;
  this.conf = conf;
  // A reader buffer to read the block
  baos = new ByteArrayOutputStream(DTFile.getFSInputBufferSize(conf) * 2);
  this.cacheKeys = new ArrayList<String>();
  // move the cursor to the beginning of the tail, containing: offset to the
  // meta block index, version and magic
  fin.seek(fileLength - Magic.size() - Version.size() - Long.SIZE
      / Byte.SIZE);
  long offsetIndexMeta = fin.readLong();
  version = new Version(fin);
  Magic.readAndVerify(fin);

  if (!version.compatibleWith(DTBCFile.API_VERSION)) {
    throw new RuntimeException("Incompatible BCFile fileBCFileVersion.");
  }

  // read meta index
  fin.seek(offsetIndexMeta);
  metaIndex = new MetaIndex(fin);

  // read data:BCFile.index, the data block index
  BlockReader blockR = getMetaBlock(DataIndex.BLOCK_NAME);
  try {
    dataIndex = new DataIndex(blockR);
  } finally {
    blockR.close();
  }
}
 
Example 6
Source Project: attic-apex-malhar   Source File: DTFile.java    License: Apache License 2.0 5 votes vote down vote up
public TFileMeta(DataInput in) throws IOException {
  version = new Version(in);
  if (!version.compatibleWith(DTFile.API_VERSION)) {
    throw new RuntimeException("Incompatible TFile fileVersion.");
  }
  recordCount = Utils.readVLong(in);
  strComparator = Utils.readString(in);
  comparator = makeComparator(strComparator);
}
 
Example 7
Source Project: RDFS   Source File: TFile.java    License: Apache License 2.0 5 votes vote down vote up
public TFileMeta(DataInput in) throws IOException {
  version = new Version(in);
  if (!version.compatibleWith(TFile.API_VERSION)) {
    throw new RuntimeException("Incompatible TFile fileVersion.");
  }
  recordCount = Utils.readVLong(in);
  strComparator = Utils.readString(in);
  comparator = makeComparator(strComparator);
}
 
Example 8
Source Project: RDFS   Source File: BCFile.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Constructor
 * 
 * @param fin
 *          FS input stream.
 * @param fileLength
 *          Length of the corresponding file
 * @throws IOException
 */
public Reader(FSDataInputStream fin, long fileLength, Configuration conf)
    throws IOException {
  this.in = fin;
  this.conf = conf;

  // move the cursor to the beginning of the tail, containing: offset to the
  // meta block index, version and magic
  fin.seek(fileLength - Magic.size() - Version.size() - Long.SIZE
      / Byte.SIZE);
  long offsetIndexMeta = fin.readLong();
  version = new Version(fin);
  Magic.readAndVerify(fin);

  if (!version.compatibleWith(BCFile.API_VERSION)) {
    throw new RuntimeException("Incompatible BCFile fileBCFileVersion.");
  }

  // read meta index
  fin.seek(offsetIndexMeta);
  metaIndex = new MetaIndex(fin);

  // read data:BCFile.index, the data block index
  BlockReader blockR = getMetaBlock(DataIndex.BLOCK_NAME);
  try {
    dataIndex = new DataIndex(blockR);
  } finally {
    blockR.close();
  }
}
 
Example 9
Source Project: hadoop-gpu   Source File: TFile.java    License: Apache License 2.0 5 votes vote down vote up
public TFileMeta(DataInput in) throws IOException {
  version = new Version(in);
  if (!version.compatibleWith(TFile.API_VERSION)) {
    throw new RuntimeException("Incompatible TFile fileVersion.");
  }
  recordCount = Utils.readVLong(in);
  strComparator = Utils.readString(in);
  comparator = makeComparator(strComparator);
}
 
Example 10
Source Project: hadoop-gpu   Source File: BCFile.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Constructor
 * 
 * @param fin
 *          FS input stream.
 * @param fileLength
 *          Length of the corresponding file
 * @throws IOException
 */
public Reader(FSDataInputStream fin, long fileLength, Configuration conf)
    throws IOException {
  this.in = fin;
  this.conf = conf;

  // move the cursor to the beginning of the tail, containing: offset to the
  // meta block index, version and magic
  fin.seek(fileLength - Magic.size() - Version.size() - Long.SIZE
      / Byte.SIZE);
  long offsetIndexMeta = fin.readLong();
  version = new Version(fin);
  Magic.readAndVerify(fin);

  if (!version.compatibleWith(BCFile.API_VERSION)) {
    throw new RuntimeException("Incompatible BCFile fileBCFileVersion.");
  }

  // read meta index
  fin.seek(offsetIndexMeta);
  metaIndex = new MetaIndex(fin);

  // read data:BCFile.index, the data block index
  BlockReader blockR = getMetaBlock(DataIndex.BLOCK_NAME);
  try {
    dataIndex = new DataIndex(blockR);
  } finally {
    blockR.close();
  }
}
 
Example 11
Source Project: hadoop   Source File: TFile.java    License: Apache License 2.0 4 votes vote down vote up
public Version getVersion() {
  return version;
}
 
Example 12
Source Project: big-c   Source File: TFile.java    License: Apache License 2.0 4 votes vote down vote up
public Version getVersion() {
  return version;
}
 
Example 13
Source Project: attic-apex-malhar   Source File: DTFile.java    License: Apache License 2.0 4 votes vote down vote up
public Version getVersion() {
  return version;
}
 
Example 14
Source Project: RDFS   Source File: TFile.java    License: Apache License 2.0 4 votes vote down vote up
public Version getVersion() {
  return version;
}
 
Example 15
Source Project: hadoop-gpu   Source File: TFile.java    License: Apache License 2.0 4 votes vote down vote up
public Version getVersion() {
  return version;
}
 
Example 16
Source Project: hadoop   Source File: BCFile.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Get version of BCFile file being read.
 * 
 * @return version of BCFile file being read.
 */
public Version getBCFileVersion() {
  return version;
}
 
Example 17
Source Project: hadoop   Source File: BCFile.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Get version of BCFile API.
 * 
 * @return version of BCFile API.
 */
public Version getAPIVersion() {
  return API_VERSION;
}
 
Example 18
Source Project: big-c   Source File: BCFile.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Get version of BCFile file being read.
 * 
 * @return version of BCFile file being read.
 */
public Version getBCFileVersion() {
  return version;
}
 
Example 19
Source Project: big-c   Source File: BCFile.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Get version of BCFile API.
 * 
 * @return version of BCFile API.
 */
public Version getAPIVersion() {
  return API_VERSION;
}
 
Example 20
Source Project: attic-apex-malhar   Source File: DTBCFile.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Get version of BCFile file being read.
 *
 * @return version of BCFile file being read.
 */
public Version getBCFileVersion() {
  return version;
}
 
Example 21
Source Project: attic-apex-malhar   Source File: DTBCFile.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Get version of BCFile API.
 *
 * @return version of BCFile API.
 */
public Version getAPIVersion() {
  return API_VERSION;
}
 
Example 22
Source Project: RDFS   Source File: BCFile.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Get version of BCFile file being read.
 * 
 * @return version of BCFile file being read.
 */
public Version getBCFileVersion() {
  return version;
}
 
Example 23
Source Project: RDFS   Source File: BCFile.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Get version of BCFile API.
 * 
 * @return version of BCFile API.
 */
public Version getAPIVersion() {
  return API_VERSION;
}
 
Example 24
Source Project: hadoop-gpu   Source File: BCFile.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Get version of BCFile file being read.
 * 
 * @return version of BCFile file being read.
 */
public Version getBCFileVersion() {
  return version;
}
 
Example 25
Source Project: hadoop-gpu   Source File: BCFile.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Get version of BCFile API.
 * 
 * @return version of BCFile API.
 */
public Version getAPIVersion() {
  return API_VERSION;
}