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.nearinfinity.blur.mapreduce.BlurTask.java

@Override
public void write(DataOutput output) throws IOException {
    output.writeLong(_maxRecordCount);//from   w w  w.j  a v a 2 s.  com
    output.writeInt(_ramBufferSizeMB);
    output.writeBoolean(_optimize);
    writeString(output, _indexingType.name());
    ByteArrayOutputStream os = new ByteArrayOutputStream();
    TIOStreamTransport trans = new TIOStreamTransport(os);
    TBinaryProtocol protocol = new TBinaryProtocol(trans);
    try {
        _tableDescriptor.write(protocol);
    } catch (TException e) {
        throw new IOException(e);
    }
    os.close();
    byte[] bs = os.toByteArray();
    output.writeInt(bs.length);
    output.write(bs);
}

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

public void write(final DataOutput out) throws IOException {
    Configuration conf = HBaseConfiguration.create();
    out.writeByte(operator.ordinal());//from w  w  w . j  a  v a2s  .c  o m
    out.writeInt(filters.size());
    for (Filter filter : filters) {
        HbaseObjectWritable.writeObject(out, filter, Writable.class, conf);
    }
}

From source file:parquet.hadoop.ParquetInputSplit.java

/**
 * {@inheritDoc}/*from ww w  . j  a v  a2 s  .  co m*/
 */
@Override
public void write(DataOutput out) throws IOException {
    super.write(out);
    out.writeInt(blocks.size());
    for (BlockMetaData block : blocks) {
        writeBlock(out, block);
    }
    Text.writeString(out, compressString(requestedSchema));
    Text.writeString(out, compressString(fileSchema));
    writeKeyValues(out, extraMetadata);
    writeKeyValues(out, readSupportMetadata);
}

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

@Override
public void write(DataOutput out) throws IOException {
    Text.writeString(out, groomName);
    Text.writeString(out, rpcServer);
    Text.writeString(out, hostName);

    out.writeInt(failures);
    out.writeInt(maxTasks);// w  w w .  j a  va 2  s .  co  m
    out.writeInt(taskReports.size());
    for (TaskStatus taskStatus : taskReports) {
        taskStatus.write(out);
    }
}

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

@Override
public void write(DataOutput out) throws IOException {
    out.writeInt(this.commandType);
    Text.writeString(out, this.initWritePath);
    Text.writeString(out, this.initReadPath);
    out.writeInt(this.ableCheckPoint);
    out.writeInt(this.nextSuperStepNum);
    out.writeInt(this.oldCheckPoint);
    out.writeInt(this.aggValues.length);
    int count = this.aggValues.length;
    for (int i = 0; i < count; i++) {
        Text.writeString(out, this.aggValues[i]);
    }// w  w w  .  j a v  a2 s .  c o m
    if (partitionToWorkerManagerNameAndPort == null) {
        WritableUtils.writeVInt(out, 0);
    } else {
        WritableUtils.writeVInt(out, partitionToWorkerManagerNameAndPort.size());
        String[] partitionToWMName = null;
        for (Integer i : this.partitionToWorkerManagerNameAndPort.keySet()) {
            partitionToWMName[i] = partitionToWorkerManagerNameAndPort.get(i);
        }
        WritableUtils.writeCompressedStringArray(out, partitionToWMName);
    }
    out.writeUTF(this.migrateStaffIDs);
    this.migrateVertexCommand.write(out);
}

From source file:parquet.hadoop.ParquetInputSplit.java

private void writeColumn(DataOutput out, ColumnChunkMetaData column) throws IOException {
    out.writeInt(column.getCodec().ordinal());
    out.writeInt(column.getPath().size());
    for (String s : column.getPath()) {
        out.writeUTF(s);/*from   w w  w . ja v a2 s  .co m*/
    }
    out.writeInt(column.getType().ordinal());
    out.writeInt(column.getEncodings().size());
    for (Encoding encoding : column.getEncodings()) {
        out.writeInt(encoding.ordinal());
    }
    out.writeLong(column.getFirstDataPageOffset());
    out.writeLong(column.getDictionaryPageOffset());
    out.writeLong(column.getValueCount());
    out.writeLong(column.getTotalSize());
    out.writeLong(column.getTotalUncompressedSize());
}

From source file:org.apache.nutch.parse.ParseData.java

public final void write(DataOutput out) throws IOException {
    out.writeByte(VERSION); // write version
    status.write(out); // write status
    Text.writeString(out, title); // write title

    out.writeInt(outlinks.length); // write outlinks
    for (int i = 0; i < outlinks.length; i++) {
        outlinks[i].write(out);//from  w  ww .ja  va 2  s  .com
    }
    contentMeta.write(out); // write content metadata
    parseMeta.write(out);
}

From source file:com.chinamobile.bcbsp.graph.EdgeManager.java

@Override
public void write(DataOutput out) throws IOException {
    if (this.currentEdgesLength == -1 || this.edgelist == null) {
        return;/*from   w ww .j a va  2  s .  com*/
    }
    out.writeInt(this.currentEdgesLength);
    // LOG.info("EDGE MANAGER SAVE============= length"
    // +this.currentEdgesLength);
    for (int i = 0; i < this.currentEdgesLength; i++) {
        // LOG.info("EDMGE MANAGER SAVE========"
        // +this.edgelist.get(0).intoString());
        this.edgelist.remove(0).write(out);
    }
    this.currentEdgesLength = -1;
    this.edgelist = null;
}

From source file:com.fiorano.openesb.application.application.LogManager.java

public void toStream(java.io.DataOutput out, int versionNo) throws java.io.IOException {

    super.toStream(out, versionNo);
    out.writeInt(props.size());
    Iterator iter = props.entrySet().iterator();
    while (iter.hasNext()) {
        Map.Entry entry = (Map.Entry) iter.next();
        UTFReaderWriter.writeUTF(out, (String) entry.getKey());
        UTFReaderWriter.writeUTF(out, (String) entry.getValue());
    }/* ww w  .  j ava2s  .c o m*/
}

From source file:org.apache.rya.accumulo.mr.RyaStatementWritable.java

/**
 * Write part of a statement to an output stream.
 * @param dataOutput Stream for writing serialized statements.
 * @param row   Individual field to write, as a byte array.
 * @throws IOException if writing to the stream fails.
 *///from  w  ww  .  j a  va2s .  c o  m
protected void write(DataOutput dataOutput, byte[] row) throws IOException {
    boolean b = row != null;
    dataOutput.writeBoolean(b);
    if (b) {
        dataOutput.writeInt(row.length);
        dataOutput.write(row);
    }
}