Java Code Examples for org.apache.hadoop.io.file.tfile.TFile.Reader.Scanner.Entry#getKeyLength()

The following examples show how to use org.apache.hadoop.io.file.tfile.TFile.Reader.Scanner.Entry#getKeyLength() . 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: TFileReader.java    From attic-apex-malhar with 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 File: TFileReader.java    From attic-apex-malhar with 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 File: TestTFileSeqFileComparison.java    From hadoop with 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 File: TestTFileSeqFileComparison.java    From big-c with 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 File: TestTFileSeqFileComparison.java    From RDFS with 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 File: TestTFileSeqFileComparison.java    From hadoop-gpu with 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;
}