Example usage for java.io DataOutput writeUTF

List of usage examples for java.io DataOutput writeUTF

Introduction

In this page you can find the example usage for java.io DataOutput writeUTF.

Prototype

void writeUTF(String s) throws IOException;

Source Link

Document

Writes two bytes of length information to the output stream, followed by the modified UTF-8 representation of every character in the string s.

Usage

From source file:org.apache.carbondata.core.metadata.schema.table.DataMapSchema.java

@Override
public void write(DataOutput out) throws IOException {
    out.writeUTF(dataMapName);
    out.writeUTF(providerName);/*from   w w w .  j a  va2s  .c o  m*/
    boolean isRelationIdentifierExists = null != relationIdentifier;
    out.writeBoolean(isRelationIdentifierExists);
    if (isRelationIdentifierExists) {
        this.relationIdentifier.write(out);
    }
    boolean isChildSchemaExists = null != this.childSchema;
    out.writeBoolean(isChildSchemaExists);
    if (isChildSchemaExists) {
        this.childSchema.write(out);
    }
    if (properties == null) {
        out.writeShort(0);
    } else {
        out.writeShort(properties.size());
        for (Map.Entry<String, String> entry : properties.entrySet()) {
            out.writeUTF(entry.getKey());
            out.writeUTF(entry.getValue());
        }
    }
}

From source file:com.mongodb.hadoop.mapred.input.MongoInputSplit.java

/**
 * Serialize the Split instance//from w ww . ja va2s  .co  m
 */

public void write(DataOutput out) throws IOException {
    final ObjectOutputStream objOut = new ObjectOutputStream((OutputStream) out);
    // TODO - Use object outputstream instead of going to <-> from string?
    out.writeUTF(_mongoURI.toString());

    out.writeUTF(JSON.serialize(_querySpec));
    out.writeUTF(JSON.serialize(_fieldSpec));
    out.writeUTF(JSON.serialize(_sortSpec));
    out.writeInt(_limit);
    out.writeInt(_skip);
    objOut.close();
}

From source file:com.davidgildeh.hadoop.input.simpledb.SimpleDBInputSplit.java

/**
 * Serialises the Split Object so it can be persisted to disk
 * //from   ww  w  . j  a  v a  2s  . c om
 * @param output            The output stream to write to
 * @throws IOException 
 */
public void write(DataOutput output) throws IOException {

    output.writeLong(startRow);
    output.writeLong(endRow);
    if (splitToken == null) {
        output.writeUTF("NULL");
    } else {
        output.writeUTF(splitToken);
    }

    if (LOG.isDebugEnabled()) {
        LOG.debug("Writing SimpleDBInputSplit: " + this.toString());
    }
}

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

/** {@inheritDoc} */
@Override/*from ww  w  . j  a va  2s.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:org.apache.hadoop.mapred.SampleTaskStatus.java

public void write(DataOutput out) throws IOException {
    if (sampleMapTaskId == null)
        sampleMapTaskId = new TaskAttemptID();
    sampleMapTaskId.write(out);/*from   w  w  w .  jav a2 s  . c om*/
    out.writeUTF(sampleMapTracker);
    out.writeLong(readInputStartTime);
    out.writeLong(readInputDoneTime);
    out.writeLong(writeOutputStartTime);
    out.writeLong(writeOutputDoneTime);
    out.writeLong(networkSampleMapCopyDurationMilliSec);
    out.writeLong(additionalSpillDurationMilliSec);
    out.writeLong(additionalSpillSize);
}

From source file:cn.ac.ict.htc.tools.ArrayListWritable.java

/**
 * Serializes this array.//  ww  w  .j  a va2 s  .  co  m
 *
 * @param out where to write the raw byte representation
 */
public void write(DataOutput out) throws IOException {
    out.writeInt(this.size());
    //      logger.info("write " + this.size() + " elements");
    if (size() == 0)
        return;
    E obj = get(0);

    out.writeUTF(obj.getClass().getCanonicalName());

    //      for (int i = 0; i < size(); i++) {
    //         obj = get(i);
    //         if (obj == null) {
    //            throw new IOException("Cannot serialize null fields!");
    //         }
    //         obj.write(out);
    //      }
}

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);/*w  w w . j a v a 2s  . c o  m*/
    if (size > 0) {
        for (String group : groups) {
            out.writeUTF(group);
        }
    }
    out.writeInt(numAttempts);
}

From source file:org.apache.hadoop.hive.accumulo.AccumuloHiveRow.java

@Override
public void write(DataOutput dataOutput) throws IOException {
    if (null != rowId) {
        dataOutput.writeBoolean(true);/*  w  ww  .j  a v  a2 s.co  m*/
        dataOutput.writeUTF(rowId);
    } else {
        dataOutput.writeBoolean(false);
    }
    int size = tuples.size();
    dataOutput.writeInt(size);
    for (ColumnTuple tuple : tuples) {
        Text cf = tuple.getCf(), cq = tuple.getCq();
        dataOutput.writeInt(cf.getLength());
        dataOutput.write(cf.getBytes(), 0, cf.getLength());
        dataOutput.writeInt(cq.getLength());
        dataOutput.write(cq.getBytes(), 0, cq.getLength());
        byte[] value = tuple.getValue();
        dataOutput.writeInt(value.length);
        dataOutput.write(value);
    }
}

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);//from   w  w  w  .  j a  va2 s  . c o m
    out.writeUTF(StringUtils.join(fields, SEPARATOR_FIELDS));
    out.writeUTF(query.toString());
    out.writeInt(maxHits);
}

From source file:org.apache.sqoop.connector.idf.CSVIntermediateDataFormat.java

/**
 * {@inheritDoc}//w w w .j a  v a  2  s  .  co  m
 */
@Override
public void write(DataOutput out) throws IOException {
    out.writeUTF(this.data);
}