Example usage for org.apache.hadoop.record RecordInput readBuffer

List of usage examples for org.apache.hadoop.record RecordInput readBuffer

Introduction

In this page you can find the example usage for org.apache.hadoop.record RecordInput readBuffer.

Prototype

Buffer readBuffer(String tag) throws IOException;

Source Link

Document

Read byte array from serialized record.

Usage

From source file:com.nexr.data.sdp.rolling.hdfs.LogRecordJT.java

License:Apache License

private void deserializeWithoutFilter(final org.apache.hadoop.record.RecordInput _rio_a, final String _rio_tag)
        throws java.io.IOException {
    _rio_a.startRecord(_rio_tag);/*w  w  w  . j  a  v  a 2 s  . c o m*/
    time = _rio_a.readLong("time");
    {
        org.apache.hadoop.record.Index _rio_midx1 = _rio_a.startMap("mapFields");
        mapFields = new java.util.TreeMap<String, org.apache.hadoop.record.Buffer>();
        for (; !_rio_midx1.done(); _rio_midx1.incr()) {
            String _rio_k1;
            _rio_k1 = _rio_a.readString("_rio_k1");
            org.apache.hadoop.record.Buffer _rio_v1;
            _rio_v1 = _rio_a.readBuffer("_rio_v1");
            mapFields.put(_rio_k1, _rio_v1);
        }
        _rio_a.endMap("mapFields");
    }
    _rio_a.endRecord(_rio_tag);
}

From source file:com.nexr.data.sdp.rolling.hdfs.LogRecordJT.java

License:Apache License

public void deserialize(final org.apache.hadoop.record.RecordInput _rio_a, final String _rio_tag)
        throws java.io.IOException {
    if (null == _rio_rtiFilter) {
        deserializeWithoutFilter(_rio_a, _rio_tag);
        return;/*  www. j  ava2s . c o m*/
    }
    // if we're here, we need to read based on version info
    _rio_a.startRecord(_rio_tag);
    setupRtiFields();
    for (int _rio_i = 0; _rio_i < _rio_rtiFilter.getFieldTypeInfos().size(); _rio_i++) {
        if (1 == _rio_rtiFilterFields[_rio_i]) {
            time = _rio_a.readLong("time");
        } else if (2 == _rio_rtiFilterFields[_rio_i]) {
            {
                org.apache.hadoop.record.Index _rio_midx1 = _rio_a.startMap("mapFields");
                mapFields = new java.util.TreeMap<String, org.apache.hadoop.record.Buffer>();
                for (; !_rio_midx1.done(); _rio_midx1.incr()) {
                    String _rio_k1;
                    _rio_k1 = _rio_a.readString("_rio_k1");
                    org.apache.hadoop.record.Buffer _rio_v1;
                    _rio_v1 = _rio_a.readBuffer("_rio_v1");
                    mapFields.put(_rio_k1, _rio_v1);
                }
                _rio_a.endMap("mapFields");
            }
        } else {
            java.util.ArrayList<org.apache.hadoop.record.meta.FieldTypeInfo> typeInfos = (java.util.ArrayList<org.apache.hadoop.record.meta.FieldTypeInfo>) (_rio_rtiFilter
                    .getFieldTypeInfos());
            org.apache.hadoop.record.meta.Utils.skip(_rio_a, typeInfos.get(_rio_i).getFieldID(),
                    typeInfos.get(_rio_i).getTypeID());
        }
    }
    _rio_a.endRecord(_rio_tag);
}