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.accumulo.core.security.AuthenticationTokenIdentifier.java

@Override
public void write(DataOutput out) throws IOException {
    if (null != impl) {
        ThriftMessageUtil msgUtil = new ThriftMessageUtil();
        ByteBuffer serialized = msgUtil.serialize(impl);
        out.writeInt(serialized.limit());
        out.write(serialized.array(), serialized.arrayOffset(), serialized.limit());
    } else {//from  w w  w . jav a 2 s  .c o  m
        out.writeInt(0);
    }
}

From source file:org.apache.mahout.df.data.Dataset.java

@Override
public void write(DataOutput out) throws IOException {
    out.writeInt(attributes.length); // nb attributes
    for (Attribute attr : attributes) {
        WritableUtils.writeString(out, attr.name());
    }// w  ww.  j a v  a2  s .  co m

    WritableUtils.writeStringArray(out, labels);

    DFUtils.writeArray(out, ignored);

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

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

From source file:org.apache.accumulo.core.client.impl.AuthenticationTokenIdentifier.java

@Override
public void write(DataOutput out) throws IOException {
    if (null != impl) {
        ThriftMessageUtil msgUtil = new ThriftMessageUtil();
        ByteBuffer serialized = msgUtil.serialize(impl);
        out.writeInt(serialized.limit());
        ByteBufferUtil.write(out, serialized);
    } else {/*from w ww .  j  a  v a  2  s.  c o m*/
        out.writeInt(0);
    }
}

From source file:org.apache.accumulo.core.clientImpl.AuthenticationTokenIdentifier.java

@Override
public void write(DataOutput out) throws IOException {
    if (impl != null) {
        ThriftMessageUtil msgUtil = new ThriftMessageUtil();
        ByteBuffer serialized = msgUtil.serialize(impl);
        out.writeInt(serialized.limit());
        ByteBufferUtil.write(out, serialized);
    } else {//  w w  w  .  j  av  a2 s .c om
        out.writeInt(0);
    }
}

From source file:parquet.hadoop.ParquetInputSplit.java

private void writeKeyValues(DataOutput out, Map<String, String> map) throws IOException {
    if (map == null) {
        out.writeInt(0);
    } else {//from   ww  w . j a  va 2  s. co m
        out.writeInt(map.size());
        for (Entry<String, String> entry : map.entrySet()) {
            out.writeUTF(entry.getKey());
            out.writeUTF(entry.getValue());
        }
    }
}

From source file:org.apache.hadoop.hbase.regionserver.wal.WALEdit.java

public void write(DataOutput out) throws IOException {
    LOG.warn("WALEdit is being serialized to writable - only expected in test code");
    out.writeInt(VERSION_2);
    out.writeInt(kvs.size());//from  w  w  w. j  av  a2s  . c  o m
    // We interleave the two lists for code simplicity
    for (KeyValue kv : kvs) {
        if (compressionContext != null) {
            KeyValueCompression.writeKV(out, kv, compressionContext);
        } else {
            KeyValue.write(kv, out);
        }
    }
    if (scopes == null) {
        out.writeInt(0);
    } else {
        out.writeInt(scopes.size());
        for (byte[] key : scopes.keySet()) {
            Bytes.writeByteArray(out, key);
            out.writeInt(scopes.get(key));
        }
    }
}

From source file:org.apache.mahout.classifier.KnnMR.data.Dataset.java

@Override
public void write(DataOutput out) throws IOException {
    out.writeInt(attributes.length); // nb attributes
    for (Attribute attr : attributes) {
        WritableUtils.writeString(out, attr.name());
    }//  w w w  .j av a 2 s . c om

    Chi_RWUtils.writeArray(out, ignored);

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

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

From source file:org.apache.hadoop.hbase.index.IndexSpecification.java

/**
 * @param Data Output Stream/*ww  w .  j  a  va 2 s  . c  o m*/
 * @throws IOException
 */
public void write(DataOutput out) throws IOException {
    Bytes.writeByteArray(out, this.name);
    out.writeInt(this.indexColumns.size());
    for (ColumnQualifier cq : this.indexColumns) {
        cq.write(out);
    }
    out.writeInt(maxVersions);
    out.writeLong(ttl);
}

From source file:org.apache.hadoop.hdfs.protocol.PolicyInfo.java

public void write(DataOutput out) throws IOException {
    Text.writeString(out, srcPath.toString());
    Text.writeString(out, description);
    out.writeInt(properties.size());
    for (Enumeration<?> e = properties.propertyNames(); e.hasMoreElements();) {
        String name = (String) e.nextElement();
        Text.writeString(out, name);
        Text.writeString(out, properties.getProperty(name));
    }//w  w  w.ja  va  2s.  c om
    out.writeInt(destPath.size());
    for (PathInfo p : destPath) {
        Text.writeString(out, p.rpath.toString());
        out.writeInt(p.myproperties.size());
        for (Enumeration<?> e = p.myproperties.propertyNames(); e.hasMoreElements();) {
            String name = (String) e.nextElement();
            Text.writeString(out, name);
            Text.writeString(out, p.myproperties.getProperty(name));
        }
    }
}

From source file:hip.ch3.seqfile.writable.StockPriceWritable.java

@Override
public void write(DataOutput out) throws IOException {
    WritableUtils.writeString(out, symbol);
    WritableUtils.writeString(out, date);
    out.writeDouble(open);//from w  ww  .j  a v a2 s  . c  o m
    out.writeDouble(high);
    out.writeDouble(low);
    out.writeDouble(close);
    out.writeInt(volume);
    out.writeDouble(adjClose);

}