Example usage for java.io DataInput readUTF

List of usage examples for java.io DataInput readUTF

Introduction

In this page you can find the example usage for java.io DataInput readUTF.

Prototype

String readUTF() throws IOException;

Source Link

Document

Reads in a string that has been encoded using a modified UTF-8 format.

Usage

From source file:org.apache.geode.management.internal.configuration.messages.ConfigurationRequest.java

@Override
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
    this.isRequestForEntireConfiguration = in.readBoolean();
    int size = in.readInt();
    Set<String> groups = new HashSet<>();
    if (size > 0) {
        for (int i = 0; i < size; i++) {
            groups.add(in.readUTF());
        }/*from www  .  ja v a  2  s  .  co m*/
    }
    this.groups = groups;
    this.numAttempts = in.readInt();
}

From source file:org.apache.hadoop.chukwa.analysis.salsa.fsm.FSMIntermedEntry.java

public void readFields(DataInput in) throws IOException {
    int currlen, numkeys;

    this.state_type = new StateType(in.readInt());
    this.state_mapred = new MapRedState(in.readInt());
    this.state_hdfs = new HDFSState(in.readInt());
    this.fsm_type = new FSMType(in.readInt());
    in.readChar();//from w  w  w. ja v a 2  s  .c  om

    currlen = in.readInt();
    if (currlen > 0)
        this.state_name = in.readUTF();
    else
        this.state_name = "";

    currlen = in.readInt();
    if (currlen > 0)
        this.unique_id = in.readUTF();
    else
        this.unique_id = "";

    currlen = in.readInt();
    if (currlen > 0)
        this.timestamp = in.readUTF();
    else
        this.timestamp = "";

    currlen = in.readInt();
    if (currlen > 0)
        this.time_start = in.readUTF();
    else
        this.time_start = "";

    currlen = in.readInt();
    if (currlen > 0)
        this.time_end = in.readUTF();
    else
        this.time_end = "";

    currlen = in.readInt();
    if (currlen > 0)
        this.host_exec = in.readUTF();
    else
        this.host_exec = "";

    currlen = in.readInt();
    if (currlen > 0)
        this.host_other = in.readUTF();
    else
        this.host_other = "";

    currlen = in.readInt();
    if (currlen > 0)
        this.time_orig_epoch = in.readUTF();
    else
        this.time_orig_epoch = "";

    currlen = in.readInt();
    if (currlen > 0)
        this.time_orig = in.readUTF();
    else
        this.time_orig = "";

    currlen = in.readInt();
    if (currlen > 0)
        this.job_id = in.readUTF();
    else
        this.job_id = "";

    currlen = in.readInt();
    if (currlen > 0)
        this.identifier = in.readUTF();
    else
        this.identifier = "";

    numkeys = in.readInt();

    this.add_info = new TreeMap<String, String>();

    if (numkeys > 0) {
        for (int i = 0; i < numkeys; i++) {
            String currkey, currval;
            currkey = in.readUTF();
            currlen = in.readInt();
            if (currlen > 0) {
                currval = in.readUTF();
                this.add_info.put(currkey, currval);
            }
        }
    }
}

From source file:org.apache.hadoop.hbase.hbql.filter.SingleColumnValueFilter.java

public void readFields(final DataInput in) throws IOException {

    this.verbose = in.readBoolean();

    this.columnFamily = Bytes.readByteArray(in);
    if (this.columnFamily.length == 0) {
        this.columnFamily = null;
    }//from w ww .jav  a  2s  .c o m
    this.columnQualifier = Bytes.readByteArray(in);
    if (this.columnQualifier.length == 0) {
        this.columnQualifier = null;
    }
    this.compareOp = CompareFilter.CompareOp.valueOf(in.readUTF());
    this.comparator = (WritableByteArrayComparable) HbaseObjectWritable.readObject(in, null);
    this.foundColumn = in.readBoolean();
    this.matchedColumn = in.readBoolean();
    this.filterIfMissing = in.readBoolean();
    this.latestVersionOnly = in.readBoolean();
}

From source file:org.apache.hadoop.hbase.HServerAddress.java

public void readFields(DataInput in) throws IOException {
    String hostname = in.readUTF();
    int port = in.readInt();
    if (hostname != null && hostname.length() > 0) {
        this.address = getResolvedAddress(new InetSocketAddress(hostname, port));
        checkBindAddressCanBeResolved();
        createCachedToString();/*ww  w  .ja v a  2  s.c om*/
    }
}

From source file:org.apache.hadoop.hbase.HServerInfo.java

public void readFields(DataInput in) throws IOException {
    this.serverAddress.readFields(in);
    this.startCode = in.readLong();
    this.load.readFields(in);
    in.readInt();/*w  w  w  .j a  va 2s  .com*/
    this.hostname = in.readUTF();
    if (sendSequenceIds) {
        HbaseMapWritable<byte[], Long> sequenceIdsWritable = new HbaseMapWritable<byte[], Long>(
                flushedSequenceIdByRegion);
        sequenceIdsWritable.readFields(in);
    }
}

From source file:org.apache.hadoop.hive.accumulo.AccumuloHiveRow.java

@Override
public void readFields(DataInput dataInput) throws IOException {
    if (dataInput.readBoolean()) {
        rowId = dataInput.readUTF();
    }// w w  w.  j  ava  2 s .co m
    int size = dataInput.readInt();
    for (int i = 0; i < size; i++) {
        int cfLength = dataInput.readInt();
        byte[] cfData = new byte[cfLength];
        dataInput.readFully(cfData, 0, cfLength);
        Text cf = new Text(cfData);
        int cqLength = dataInput.readInt();
        byte[] cqData = new byte[cqLength];
        dataInput.readFully(cqData, 0, cqLength);
        Text cq = new Text(cqData);
        int valSize = dataInput.readInt();
        byte[] val = new byte[valSize];
        for (int j = 0; j < valSize; j++) {
            val[j] = dataInput.readByte();
        }
        tuples.add(new ColumnTuple(cf, cq, val));
    }
}

From source file:org.apache.hadoop.hive.llap.security.LlapTokenIdentifier.java

@Override
public void readFields(DataInput in) throws IOException {
    super.readFields(in);
    clusterId = in.readUTF();
    Preconditions.checkNotNull(clusterId);
    appId = in.readUTF();/*from w w w  . j a  v  a 2 s . c  om*/
    isSigningRequired = in.readBoolean();
    appId = appId == null ? "" : appId;
}

From source file:org.apache.hadoop.hive.ql.io.BucketizedHiveInputSplit.java

@Override
public void readFields(DataInput in) throws IOException {
    String inputSplitClassName = in.readUTF();

    int numSplits = in.readInt();
    inputSplits = new InputSplit[numSplits];
    for (int i = 0; i < numSplits; i++) {
        try {//from  w w  w .j  a  v  a 2 s  .  c o m
            inputSplits[i] = (InputSplit) ReflectionUtils.newInstance(conf.getClassByName(inputSplitClassName),
                    conf);
        } catch (Exception e) {
            throw new IOException("Cannot create an instance of InputSplit class = " + inputSplitClassName + ":"
                    + e.getMessage());
        }
        inputSplits[i].readFields(in);
    }
    inputFormatClassName = in.readUTF();
}

From source file:org.apache.hadoop.ipc.ConnectionHeader.java

@Override
public void readFields(DataInput in) throws IOException {
    protocol = Text.readString(in);
    if (protocol.isEmpty()) {
        protocol = null;/*from w ww.j  a va2  s  . c o m*/
    }

    boolean ugiUsernamePresent = in.readBoolean();
    if (ugiUsernamePresent) {
        String username = in.readUTF();
        boolean realUserNamePresent = in.readBoolean();
        if (realUserNamePresent) {
            String realUserName = in.readUTF();
            UserGroupInformation realUserUgi = UserGroupInformation.createRemoteUser(realUserName);
            ugi = UserGroupInformation.createProxyUser(username, realUserUgi);
        } else {
            ugi = UserGroupInformation.createRemoteUser(username);
        }
    } else {
        ugi = null;
    }
}

From source file:org.apache.hadoop.mapred.JTAddress.java

public void readFields(DataInput in) throws IOException {
    String hostname = in.readUTF();
    int port = in.readInt();

    if (hostname == null || hostname.length() == 0) {
        address = null;//  w  w w . ja  va  2s  . co m
        stringValue = null;
    } else {
        address = new InetSocketAddress(hostname, port);
        stringValue = hostname + ":" + port;
        checkBindAddressCanBeResolved();
    }
}