Example usage for java.io DataOutput writeInt

List of usage examples for java.io DataOutput writeInt

Introduction

In this page you can find the example usage for java.io DataOutput writeInt.

Prototype

void writeInt(int v) throws IOException;

Source Link

Document

Writes an int value, which is comprised of four bytes, to the output stream.

Usage

From source file:com.wsc.myexample.decisionForest.MyDataset.java

public void write(DataOutput out) throws IOException {
    out.writeInt(attributes.length); // nb attributes
    for (Dataset.Attribute attr : attributes) {
        writeString(out, attr.name());/* w  w  w  .jav a2 s  .  c  o m*/
    }

    MyDFUtils.writeArray(out, ignored);

    // only CATEGORICAL attributes have values
    for (String[] vals : values) {
        if (vals != null) {
            writeStringArray(out, vals);
        }
    }

    out.writeInt(labelId);
    out.writeInt(nbInstances);
}

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

public void write(DataOutput out) throws IOException {
    Set<String> mapKeys;

    out.writeInt(this.state_type.val);
    out.writeInt(this.state_mapred.val);
    out.writeInt(this.state_hdfs.val);
    out.writeInt(this.fsm_type.val);
    out.writeChar(DELIM);/*from   w  w  w.java  2  s  .c o  m*/
    out.writeInt(state_name.length());
    if (state_name.length() > 0)
        out.writeUTF(state_name);
    out.writeInt(unique_id.length());
    if (unique_id.length() > 0)
        out.writeUTF(unique_id);
    out.writeInt(timestamp.length());
    if (timestamp.length() > 0)
        out.writeUTF(timestamp);
    out.writeInt(time_start.length());
    if (time_start.length() > 0)
        out.writeUTF(time_start);
    out.writeInt(time_end.length());
    if (time_end.length() > 0)
        out.writeUTF(time_end);
    out.writeInt(host_exec.length());
    if (host_exec.length() > 0)
        out.writeUTF(host_exec);
    out.writeInt(host_other.length());
    if (host_other.length() > 0)
        out.writeUTF(host_other);
    out.writeInt(time_orig_epoch.length());
    if (time_orig_epoch.length() > 0)
        out.writeUTF(time_orig_epoch);
    out.writeInt(time_orig.length());
    if (time_orig.length() > 0)
        out.writeUTF(time_orig);
    out.writeInt(job_id.length());
    if (job_id.length() > 0)
        out.writeUTF(job_id);
    out.writeInt(identifier.length());
    if (identifier.length() > 0)
        out.writeUTF(identifier);

    mapKeys = this.add_info.keySet();
    out.writeInt(mapKeys.size());

    for (Entry<String, String> entry : this.add_info.entrySet()) {
        String value = entry.getValue();
        if (value.length() > 0) {
            out.writeUTF(entry.getKey());
            out.writeInt(value.length());
            out.writeUTF(value);
        } else {
            out.writeUTF("NULL");
            out.writeInt(0);
        }
    }
}

From source file:com.chinamobile.bcbsp.sync.SuperStepReportContainer.java

@Override
public void write(DataOutput out) throws IOException {
    out.writeInt(this.partitionId);
    out.writeInt(this.stageFlag);
    out.writeInt(this.dirFlag.length);
    int count = this.dirFlag.length;
    for (int i = 0; i < count; i++) {
        Text.writeString(out, this.dirFlag[i]);
    }//w w  w .ja v a2s .co  m
    out.writeLong(this.judgeFlag);
    out.writeInt(this.localBarrierNum);
    out.writeInt(this.port1);
    out.writeInt(this.port2);
    out.writeInt(this.aggValues.length);
    count = this.aggValues.length;
    for (int i = 0; i < count; i++) {
        Text.writeString(out, this.aggValues[i]);
    }
    out.writeLong(this.staffRunTime);
    out.writeInt(this.sid);
    out.writeInt(this.currentSuperStep);
    out.writeLong(this.migrateCost);
    out.writeFloat(this.splitEdgefactor);
}

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

public synchronized void write(DataOutput out) throws IOException {
    out.writeLong(indicesCount);/*from   www  .ja  v  a2s  .  co m*/
    out.writeInt(ranges.size());
    Iterator<Range> it = ranges.iterator();
    while (it.hasNext()) {
        Range range = it.next();
        range.write(out);
    }
}

From source file:TVA.Hadoop.MapReduce.Historian.File.StandardPointFile.java

/**
 * Serializes the point to disk./* w w w.  j  a va  2 s.c o m*/
 * 
 * @param    out         A DataOutput object to write data to.
 * @see       DataOutput   
 * @see org.apache.hadoop.io.Writable#write(java.io.DataOutput)
 * 
 */
public void write(DataOutput out) throws IOException {

    out.writeInt(iTimeTag);
    out.writeShort(this.Flags);
    out.writeFloat(this.Value);
    out.writeInt(this.iPointID);

}

From source file:ml.shifu.shifu.core.correlation.CorrelationWritable.java

@Override
public void write(DataOutput out) throws IOException {
    out.writeInt(this.columnIndex);
    out.writeDouble(this.sum);
    out.writeDouble(this.sumSquare);
    out.writeDouble(this.count);
    if (this.xySum == null) {
        out.writeInt(0);/*from   ww w.  j  av a 2s . com*/
    } else {
        out.writeInt(this.xySum.length);
        for (double doub : this.xySum) {
            out.writeDouble(doub);
        }
    }

    if (this.xxSum == null) {
        out.writeInt(0);
    } else {
        out.writeInt(this.xxSum.length);
        for (double doub : this.xxSum) {
            out.writeDouble(doub);
        }
    }

    if (this.yySum == null) {
        out.writeInt(0);
    } else {
        out.writeInt(this.yySum.length);
        for (double doub : this.yySum) {
            out.writeDouble(doub);
        }
    }

    if (this.adjustCount == null) {
        out.writeInt(0);
    } else {
        out.writeInt(this.adjustCount.length);
        for (double doub : this.adjustCount) {
            out.writeDouble(doub);
        }
    }

    if (this.adjustSumX == null) {
        out.writeInt(0);
    } else {
        out.writeInt(this.adjustSumX.length);
        for (double doub : this.adjustSumX) {
            out.writeDouble(doub);
        }
    }

    if (this.adjustSumY == null) {
        out.writeInt(0);
    } else {
        out.writeInt(this.adjustSumY.length);
        for (double doub : this.adjustSumY) {
            out.writeDouble(doub);
        }
    }
}

From source file:ml.shifu.shifu.core.dtrain.dataset.PersistBasicFloatNetwork.java

private void writeIntArray(DataOutput out, int[] array) throws IOException {
    if (array == null) {
        out.writeInt(0);
    } else {// w  w w  .j  a  va 2 s.co m
        out.writeInt(array.length);
        for (int i : array) {
            out.writeInt(i);
        }
    }
}

From source file:ml.shifu.shifu.core.dtrain.dataset.PersistBasicFloatNetwork.java

private void writeDoubleArray(DataOutput out, double[] array) throws IOException {
    if (array == null) {
        out.writeInt(0);
    } else {// ww  w  .j  ava  2  s  .  c om
        out.writeInt(array.length);
        for (double d : array) {
            out.writeDouble(d);
        }
    }
}

From source file:com.mobicage.rogerthat.registration.ContentBrandingRegistrationWizard.java

@Override
public void writePickle(DataOutput out) throws IOException {
    T.UI();// w  ww.  j a  v  a 2  s  . c om
    boolean set = mCredentials != null;
    out.writeBoolean(set);
    if (set) {
        out.writeInt(mCredentials.getPickleClassVersion());
        mCredentials.writePickle(out);
    }
    set = mEmail != null;
    out.writeBoolean(set);
    if (set)
        out.writeUTF(mEmail);
    out.writeLong(mTimestamp);
    out.writeUTF(mRegistrationId);
    out.writeUTF(mInstallationId);
    out.writeUTF(mDeviceId);
}

From source file:org.apache.hama.bsp.JobStatus.java

@Override
public synchronized void write(DataOutput out) throws IOException {
    jobid.write(out);//from  w w  w.  j  a  v  a2s  .c om
    out.writeLong(setupProgress);
    out.writeLong(progress);
    out.writeLong(cleanupProgress);
    out.writeInt(runState);
    out.writeLong(startTime);
    out.writeLong(finishTime);
    Text.writeString(out, user);
    Text.writeString(out, schedulingInfo);
    out.writeLong(superstepCount);
    counter.write(out);
}