Java 类org.apache.hadoop.hbase.codec.Decoder 实例源码

项目:LCIndex-HBase-0.94.16    文件:WALEdit.java   
public void readFields(DataInput in) throws IOException {
  kvs.clear();
  scopes.clear();
  Decoder decoder = this.codec.getDecoder((DataInputStream) in);
  int versionOrLength = in.readInt();
  int length = versionOrLength;

  // make sure we get the real length
  if (versionOrLength == VERSION_2) {
    length = in.readInt();
  }

  // read in all the key values
  kvs.ensureCapacity(length);
  for(int i=0; i< length && decoder.advance(); i++) {
    kvs.add(decoder.current());
  }

  //its a new style WAL, so we need replication scopes too
  if (versionOrLength == VERSION_2) {
    int numEntries = in.readInt();
    if (numEntries > 0) {
      for (int i = 0; i < numEntries; i++) {
        byte[] key = Bytes.readByteArray(in);
        int scope = in.readInt();
        scopes.put(key, scope);
      }
    }
  }
}
项目:IRIndex    文件:WALEdit.java   
public void readFields(DataInput in) throws IOException {
  kvs.clear();
  scopes.clear();
  Decoder decoder = this.codec.getDecoder((DataInputStream) in);
  int versionOrLength = in.readInt();
  int length = versionOrLength;

  // make sure we get the real length
  if (versionOrLength == VERSION_2) {
    length = in.readInt();
  }

  // read in all the key values
  kvs.ensureCapacity(length);
  for(int i=0; i< length && decoder.advance(); i++) {
    kvs.add(decoder.current());
  }

  //its a new style WAL, so we need replication scopes too
  if (versionOrLength == VERSION_2) {
    int numEntries = in.readInt();
    if (numEntries > 0) {
      for (int i = 0; i < numEntries; i++) {
        byte[] key = Bytes.readByteArray(in);
        int scope = in.readInt();
        scopes.put(key, scope);
      }
    }
  }
}
项目:HBase-Research    文件:WALEdit.java   
public void readFields(DataInput in) throws IOException {
  kvs.clear();
  if (scopes != null) {
    scopes.clear();
  }
  Decoder decoder = this.codec.getDecoder((DataInputStream) in);
  int versionOrLength = in.readInt();
  int length = versionOrLength;

  // make sure we get the real length
  if (versionOrLength == VERSION_2) {
    length = in.readInt();
  }

  // read in all the key values
  for(int i=0; i< length && decoder.advance(); i++) {
    kvs.add(decoder.current());
  }

  //its a new style WAL, so we need replication scopes too
  if (versionOrLength == VERSION_2) {
    int numFamilies = in.readInt();
    if (numFamilies > 0) {
      if (scopes == null) {
        scopes = new TreeMap<byte[], Integer>(Bytes.BYTES_COMPARATOR);
      }
      for (int i = 0; i < numFamilies; i++) {
        byte[] fam = Bytes.readByteArray(in);
        int scope = in.readInt();
        scopes.put(fam, scope);
      }
    }
  }
}
项目:LCIndex-HBase-0.94.16    文件:WALEditCodec.java   
@Override
public Decoder getDecoder(InputStream is) {
  return
      (compression == null) ? new KeyValueCodec.KeyValueDecoder((DataInputStream) is)
          : new KeyValueCompression.CompressedKvDecoder((DataInputStream) is, compression);
}
项目:IRIndex    文件:WALEditCodec.java   
@Override
public Decoder getDecoder(InputStream is) {
  return
      (compression == null) ? new KeyValueCodec.KeyValueDecoder((DataInputStream) is)
          : new KeyValueCompression.CompressedKvDecoder((DataInputStream) is, compression);
}
项目:HBase-Research    文件:WALEditCodec.java   
@Override
public Decoder getDecoder(InputStream is) {
  return
      (compression == null) ? new KeyValueCodec.KeyValueDecoder((DataInputStream) is)
          : new KeyValueCompression.CompressedKvDecoder((DataInputStream) is, compression);
}