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.kylin.dict.lookup.SnapshotTable.java

void writeData(DataOutput out) throws IOException {
    out.writeInt(rowIndices.size());
    if (rowIndices.size() > 0) {
        int n = rowIndices.get(0).length;
        out.writeInt(n);//from ww w. ja  v  a  2s .  co m

        if (this.useDictionary == true) {
            dict.write(out);
            for (int i = 0; i < rowIndices.size(); i++) {
                int[] row = rowIndices.get(i);
                for (int j = 0; j < n; j++) {
                    out.writeInt(row[j]);
                }
            }

        } else {
            for (int i = 0; i < rowIndices.size(); i++) {
                int[] row = rowIndices.get(i);
                for (int j = 0; j < n; j++) {
                    // NULL_STR is tricky, but we don't want to break the current snapshots
                    out.writeUTF(dict.getValueFromId(row[j]) == null ? NULL_STR : dict.getValueFromId(row[j]));
                }
            }
        }
    }
}

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

@Override
public void write(DataOutput out) throws IOException {
    out.writeDouble(x);//w  w  w.j  a  va  2  s .co  m
    out.writeDouble(y);
    out.writeDouble(tileWidth);
    out.writeDouble(tileHeight);
    out.writeInt(numTiles);
}

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

@Override
public void write(DataOutput out) throws IOException {
    assert (inputSplits != null && inputSplits.length > 0);
    out.writeUTF(inputSplits[0].getClass().getName());
    out.writeInt(inputSplits.length);
    for (InputSplit inputSplit : inputSplits) {
        inputSplit.write(out);/*from   www .j  a v a  2  s.  c  o  m*/
    }
    out.writeUTF(inputFormatClassName);
}

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

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

From source file:IndexService.IColumnInputSplit.java

@Override
public void write(DataOutput out) throws IOException {
    out.writeUTF(file.toString());//from   w  w w  .jav a 2s. co  m
    out.writeBoolean(splitbyline);
    out.writeBoolean(this.wholefileASasplit);
    if (splitbyline) {
        if (!wholefileASasplit) {
            out.writeInt(beginline);
            out.writeInt(recnum);
        }
    } else {
        beginkey.write(out);
        out.writeInt(recnum);
    }
}

From source file:org.apache.geode.cache.query.data.Portfolio.java

public void toData(DataOutput out) throws IOException {
      out.writeInt(this.ID);
      if (this.shortID == null) {
          DataSerializer.writePrimitiveBoolean(true, out);
      } else {/*www  .  j  av a 2s  .co m*/
          DataSerializer.writePrimitiveBoolean(false, out);
          DataSerializer.writeShort(this.shortID, out);
      }

      DataSerializer.writeString(this.pkid, out);
      DataSerializer.writeObject(this.position1, out);
      DataSerializer.writeObject(this.position2, out);
      DataSerializer.writeObject(this.positions, out);
      DataSerializer.writeObject(this.collectionHolderMap, out);
      DataSerializer.writeString(this.type, out);
      DataSerializer.writeString(this.status, out);
      DataSerializer.writeStringArray(this.names, out);
      DataSerializer.writeString(this.description, out);
      DataSerializer.writePrimitiveLong(this.createTime, out);
      DataSerializer.writeDate(createDate, out);
      // Write Position3.
      if (this.position3 == null) {
          out.writeInt(0);
      } else {
          out.writeInt(this.position3.length);
          for (int i = 0; i < position3.length; i++) {
              DataSerializer.writeObject(this.position3[i], out);
          }
      }
      out.writeInt(this.indexKey);
  }

From source file:com.nearinfinity.blur.mapreduce.BlurTask.java

private void writeString(DataOutput output, String s) throws IOException {
    byte[] bs = s.getBytes();
    output.writeInt(bs.length);
    output.write(bs);//from w ww. ja  v  a  2 s . c o m
}

From source file:edu.umn.cs.spatialHadoop.core.OGCShape.java

@Override
public void write(DataOutput out) throws IOException {
    byte[] bytes = geom.asBinary().array();
    out.writeInt(bytes.length);
    out.write(bytes);//from   w  w w  .  jav  a 2  s. c  o  m
    if (extra == null) {
        out.writeInt(-1);
    } else {
        bytes = extra.getBytes();
        out.writeInt(bytes.length);
        out.write(bytes);
    }
}

From source file:parquet.hadoop.ParquetInputSplit.java

private void writeBlock(DataOutput out, BlockMetaData block) throws IOException {
    out.writeInt(block.getColumns().size());
    for (ColumnChunkMetaData column : block.getColumns()) {
        writeColumn(out, column);//from w ww  .java 2s. c om
    }
    out.writeLong(block.getRowCount());
    out.writeLong(block.getTotalByteSize());
    out.writeBoolean(block.getPath() == null);
    if (block.getPath() != null) {
        out.writeUTF(block.getPath());
    }
}

From source file:com.blackberry.logdriver.boom.LogLineData.java

@Override
public void write(DataOutput out) throws IOException {
    out.writeLong(timestamp);//from   ww w. j ava2  s  .c o  m
    out.writeLong(createTime);
    out.writeLong(blockNumber);
    out.writeLong(lineNumber);
    out.writeInt(eventId);
}