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:org.apache.mahout.clustering.meanshift.MeanShiftCanopy.java

@Override
public void write(DataOutput out) throws IOException {
    super.write(out);
    out.writeInt(boundPoints.size());
    for (int v : boundPoints.elements()) {
        out.writeInt(v);//from   w  ww .  jav a 2 s  .c  o  m
    }
}

From source file:org.apache.giraph.block_app.reducers.array.ArrayReduce.java

@Override
public void write(DataOutput out) throws IOException {
    out.writeInt(fixedSize);
    WritableUtils.writeWritableObject(elementReduceOp, out);
}

From source file:com.liveramp.cascading_ext.bloom.BloomFilter.java

@Override
public void write(DataOutput out) throws IOException {
    out.writeInt(this.numHashes);
    out.writeLong(this.vectorSize);
    out.writeLong(this.numElems);
    out.write(this.bits.getRaw());
    byte[] serializedHashFunction = SerializationUtils.serialize(this.hashFunction);
    out.writeInt(serializedHashFunction.length);
    out.write(serializedHashFunction);/*from w  w  w . j a  va  2 s . c  om*/
}

From source file:org.kiji.schema.mapreduce.KijiIncrement.java

/** {@inheritDoc} */
@Override//from   w  ww. j a  va 2 s.  co m
public void write(DataOutput out) throws IOException {
    final byte[] bytes = mEntityId.getHBaseRowKey();
    out.writeInt(bytes.length);
    out.write(bytes);

    // Family/Qualifier/Amount.
    out.writeUTF(mFamily);
    out.writeUTF(mQualifier);
    out.writeLong(mAmount);
}

From source file:StorageEngineClient.MultiFormatStorageSplit.java

@Override
public void write(DataOutput out) throws IOException {
    if (path == null || path.length == 0) {
        out.writeInt(0);
    } else {//  w w w  . j  a v  a2 s  .  c o  m
        out.writeInt(path.length);
        for (int i = 0; i < path.length; i++) {
            int len = path[i].toString().length();
            if (len == 0) {
                out.writeShort((short) 0);
            } else {
                out.writeShort((short) len);
                out.write(path[i].toString().getBytes());
            }
        }
    }
}

From source file:org.apache.hadoop.io.BytesWritable.java

public void write(DataOutput out) throws IOException {
    out.writeInt(size);
    out.write(bytes, 0, size);
}

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

@Override
public void toData(DataOutput out) throws IOException {
    out.writeBoolean(isRequestForEntireConfiguration);
    int size = groups.size();
    out.writeInt(size);
    if (size > 0) {
        for (String group : groups) {
            out.writeUTF(group);/*from w  w  w  . ja  v a  2 s  .  c  o  m*/
        }
    }
    out.writeInt(numAttempts);
}

From source file:org.apache.giraph.graph.VertexMutations.java

@Override
public void write(DataOutput output) throws IOException {
    output.writeInt(addedVertexList.size());
    for (BasicVertex<I, V, E, M> vertex : addedVertexList) {
        vertex.write(output);// ww  w.ja  v  a 2s  . c o m
    }
    output.writeInt(removedVertexCount);
    output.writeInt(addedEdgeList.size());
    for (Edge<I, E> edge : addedEdgeList) {
        edge.getDestVertexId().write(output);
        edge.getEdgeValue().write(output);
    }
    output.writeInt(removedEdgeList.size());
    for (I removedEdge : removedEdgeList) {
        removedEdge.write(output);
    }
}

From source file:edu.umn.cs.spatialHadoop.indexing.BTRPartitioner.java

@Override
public void write(DataOutput out) throws IOException {
    mbr.write(out);//  www  .  j  a v  a 2s.  c o m
    out.writeInt(columns);
    out.writeInt(rows);
    ByteBuffer bbuffer = ByteBuffer.allocate((xSplits.length + ySplits.length) * 8);
    for (double xSplit : xSplits)
        bbuffer.putDouble(xSplit);
    for (double ySplit : ySplits)
        bbuffer.putDouble(ySplit);
    if (bbuffer.hasRemaining())
        throw new RuntimeException("Did not calculate buffer size correctly");
    out.write(bbuffer.array(), bbuffer.arrayOffset(), bbuffer.position());
}

From source file:org.apache.crunch.io.FormatBundle.java

@Override
public void write(DataOutput out) throws IOException {
    Text.writeString(out, formatClass.getName());
    out.writeInt(extraConf.size());
    for (Map.Entry<String, String> e : extraConf.entrySet()) {
        Text.writeString(out, e.getKey());
        Text.writeString(out, e.getValue());
    }/*from ww w .jav  a 2s .c o  m*/
}