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:eu.stratosphere.configuration.Configuration.java

@Override
public void write(final DataOutput out) throws IOException {

    synchronized (this.confData) {

        out.writeInt(this.confData.size());

        final Iterator<String> it = this.confData.keySet().iterator();
        while (it.hasNext()) {
            final String key = it.next();
            final String value = this.confData.get(key);
            StringRecord.writeString(out, key);
            StringRecord.writeString(out, value);
        }/*  ww  w  .  j  a  v a2s .  c o m*/
    }
}

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

public void write(DataOutput out) throws IOException {
    taskid.write(out);/*from  ww  w  . j a va 2s.c  o  m*/
    out.writeFloat(progress);
    out.writeInt(numSlots);
    WritableUtils.writeEnum(out, runState);
    Text.writeString(out, diagnosticInfo);
    Text.writeString(out, stateString);
    WritableUtils.writeEnum(out, phase);
    out.writeLong(startTime);
    out.writeLong(finishTime);
    out.writeBoolean(includeCounters);
    out.writeLong(outputSize);
    if (includeCounters) {
        counters.write(out);
    }
    nextRecordRange.write(out);
}

From source file:de.hpi.fgis.hdrs.Triple.java

public static void writeTriple(DataOutput stream, Triple t) throws IOException {
    stream.writeShort(t.getSubjectLength());
    stream.writeShort(t.getPredicateLength());
    stream.writeInt(t.getObjectLength());
    stream.writeInt(t.getMultiplicity());
    if (0 < t.getSubjectLength())
        stream.write(t.getBuffer(), t.getOffset(), t.getSubjectLength());
    if (0 < t.getPredicateLength())
        stream.write(t.getBuffer(), t.getPredicateOffset(), t.getPredicateLength());
    if (0 < t.getObjectLength())
        stream.write(t.getBuffer(), t.getObjectOffset(), t.getObjectLength());
}

From source file:com.chinamobile.bcbsp.workermanager.WorkerManagerStatus.java

@Override
public void write(DataOutput out) throws IOException {
    Text.writeString(out, this.workerManagerName);
    Text.writeString(out, this.rpc);
    Text.writeString(out, this.host);
    Text.writeString(out, this.httpPort);
    Text.writeString(out, this.localIp);
    out.writeInt(this.staffReports.size());
    for (StaffStatus staffStatus : this.staffReports) {
        staffStatus.write(out);/*ww  w .j  a  va  2s.  c  o m*/
    }
    out.writeInt(this.workerFaultList.size());
    for (Fault faultTemp : this.workerFaultList) {
        faultTemp.write(out);
    }
    out.writeInt(this.maxStaffsCount);
    out.writeInt(this.runningStaffsCount);
    out.writeInt(this.finishedStaffsCount);
    out.writeInt(this.failedStaffsCount);
}

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

@SuppressWarnings("unchecked")
@Override//  ww w .j  a  va 2s.  c o  m
public void writePickle(DataOutput out) throws IOException {
    T.UI();
    super.writePickle(out);
    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.writeBoolean(mInGoogleAuthenticationProcess);
    out.writeUTF(mInstallationId);
    out.writeUTF(mDeviceId);
    set = mBeaconRegions != null;
    out.writeBoolean(set);
    if (set)
        out.writeUTF(JSONValue.toJSONString(mBeaconRegions.toJSONMap()));
    set = mDetectedBeacons != null;
    out.writeBoolean(set);
    if (set) {
        JSONArray db1 = new JSONArray();
        for (String db : mDetectedBeacons) {
            db1.add(db);
        }
        out.writeUTF(JSONValue.toJSONString(db1));
    }
}

From source file:org.apache.nutch.webapp.common.Search.java

public void write(DataOutput out) throws IOException {
    LOG.info("writing hits");
    hits.write(out);//from w  w  w  . j  a v a2  s .c  o  m
    out.writeInt(show.length);

    for (int i = 0; i < show.length; i++) {
        show[i].write(out);
    }

    out.writeInt(details.length);
    for (int i = 0; i < details.length; i++) {
        details[i].write(out);
    }

    out.writeInt(summaries.length);
    for (int i = 0; i < summaries.length; i++) {
        summaries[i].write(out);
    }

}

From source file:org.apache.pig.data.DefaultTuple.java

@Override
public void write(DataOutput out) throws IOException {
    out.writeByte(DataType.TUPLE);/*from   w  w w  .jav  a 2 s. com*/
    int sz = size();
    out.writeInt(sz);
    for (int i = 0; i < sz; i++) {
        DataReaderWriter.writeDatum(out, mFields.get(i));
    }
}

From source file:org.apache.hama.ml.ann.SmallLayeredNeuralNetwork.java

@Override
public void write(DataOutput output) throws IOException {
    super.write(output);

    // write squashing functions
    output.writeInt(this.squashingFunctionList.size());
    for (DoubleFunction aSquashingFunctionList : this.squashingFunctionList) {
        WritableUtils.writeString(output, aSquashingFunctionList.getFunctionName());
    }/*w w w.  j a v a2  s . c o m*/

    // write weight matrices
    output.writeInt(this.weightMatrixList.size());
    for (DoubleMatrix aWeightMatrixList : this.weightMatrixList) {
        MatrixWritable.write(aWeightMatrixList, output);
    }

    // DO NOT WRITE WEIGHT UPDATE
}

From source file:org.apache.mahout.text.LuceneStorageConfiguration.java

@Override
public void write(DataOutput out) throws IOException {
    out.writeUTF(sequenceFilesOutputPath.toString());
    out.writeUTF(StringUtils.join(indexPaths, SEPARATOR_PATHS));
    out.writeUTF(idField);/*www .  j  a  v  a  2  s  .  c  o  m*/
    out.writeUTF(StringUtils.join(fields, SEPARATOR_FIELDS));
    out.writeUTF(query.toString());
    out.writeInt(maxHits);
}

From source file:org.apache.carbondata.core.metadata.blocklet.BlockletInfo.java

/**
 * Serialize datachunks as well for older versions like V1 and V2
 *//*w ww.j av a  2  s. co  m*/
private void writeChunkInfoForOlderVersions(DataOutput output) throws IOException {
    int dimChunksSize = dimensionColumnChunk != null ? dimensionColumnChunk.size() : 0;
    output.writeShort(dimChunksSize);
    for (int i = 0; i < dimChunksSize; i++) {
        byte[] bytes = serializeDataChunk(dimensionColumnChunk.get(i));
        output.writeInt(bytes.length);
        output.write(bytes);
    }
    int msrChunksSize = measureColumnChunk != null ? measureColumnChunk.size() : 0;
    output.writeShort(msrChunksSize);
    for (int i = 0; i < msrChunksSize; i++) {
        byte[] bytes = serializeDataChunk(measureColumnChunk.get(i));
        output.writeInt(bytes.length);
        output.write(bytes);
    }
}