Java Code Examples for org.apache.hadoop.io.file.tfile.TFile.Reader.Scanner.Entry

The following examples show how to use org.apache.hadoop.io.file.tfile.TFile.Reader.Scanner.Entry. 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: attic-apex-malhar   Source File: TFileReader.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void readFully(TreeMap<Slice, Slice> data) throws IOException
{
  scanner.rewind();
  for (; !scanner.atEnd(); scanner.advance()) {
    Entry en = scanner.entry();
    int klen = en.getKeyLength();
    int vlen = en.getValueLength();
    byte[] key = new byte[klen];
    byte[] value = new byte[vlen];
    en.getKey(key);
    en.getValue(value);
    data.put(new Slice(key, 0, key.length), new Slice(value, 0, value.length));
  }

}
 
Example 2
Source Project: attic-apex-malhar   Source File: TFileReader.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public boolean peek(Slice key, Slice value) throws IOException
{
  if (scanner.atEnd()) {
    return false;
  }
  Entry en = scanner.entry();
  byte[] rkey = new byte[en.getKeyLength()];
  byte[] rval = new byte[en.getValueLength()];
  en.getKey(rkey);
  en.getValue(rval);

  key.buffer = rkey;
  key.offset = 0;
  key.length = en.getKeyLength();

  value.buffer = rval;
  value.offset = 0;
  value.length = en.getValueLength();

  return true;
}
 
Example 3
Source Project: hadoop   Source File: TestTFileSeqFileComparison.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public boolean next() throws IOException {
  if (scanner.atEnd()) return false;
  Entry entry = scanner.entry();
  keyLength = entry.getKeyLength();
  checkKeyBuffer(keyLength);
  entry.getKey(keyBuffer);
  valueLength = entry.getValueLength();
  checkValueBuffer(valueLength);
  entry.getValue(valueBuffer);
  scanner.advance();
  return true;
}
 
Example 4
Source Project: big-c   Source File: TestTFileSeqFileComparison.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public boolean next() throws IOException {
  if (scanner.atEnd()) return false;
  Entry entry = scanner.entry();
  keyLength = entry.getKeyLength();
  checkKeyBuffer(keyLength);
  entry.getKey(keyBuffer);
  valueLength = entry.getValueLength();
  checkValueBuffer(valueLength);
  entry.getValue(valueBuffer);
  scanner.advance();
  return true;
}
 
Example 5
Source Project: RDFS   Source File: TestTFileSeqFileComparison.java    License: Apache License 2.0 5 votes vote down vote up
public boolean next() throws IOException {
  if (scanner.atEnd()) return false;
  Entry entry = scanner.entry();
  keyLength = entry.getKeyLength();
  checkKeyBuffer(keyLength);
  entry.getKey(keyBuffer);
  valueLength = entry.getValueLength();
  checkValueBuffer(valueLength);
  entry.getValue(valueBuffer);
  scanner.advance();
  return true;
}
 
Example 6
Source Project: hadoop-gpu   Source File: TestTFileSeqFileComparison.java    License: Apache License 2.0 5 votes vote down vote up
public boolean next() throws IOException {
  if (scanner.atEnd()) return false;
  Entry entry = scanner.entry();
  keyLength = entry.getKeyLength();
  checkKeyBuffer(keyLength);
  entry.getKey(keyBuffer);
  valueLength = entry.getValueLength();
  checkValueBuffer(valueLength);
  entry.getValue(valueBuffer);
  scanner.advance();
  return true;
}