Example usage for org.apache.hadoop.io Text writeString

List of usage examples for org.apache.hadoop.io Text writeString

Introduction

In this page you can find the example usage for org.apache.hadoop.io Text writeString.

Prototype

public static int writeString(DataOutput out, String s) throws IOException 

Source Link

Document

Write a UTF8 encoded string to out

Usage

From source file:gaffer.utils.WritableToStringConverter.java

License:Apache License

public static String serialiseToString(Writable writable) throws IOException {
    // Serialise to a byte array
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    DataOutputStream out = new DataOutputStream(baos);
    Text.writeString(out, writable.getClass().getName());
    writable.write(out);//from  w  w  w .j  a v  a  2  s  .c o m

    // Convert the byte array to a base64 string
    return Base64.encodeBase64String(baos.toByteArray());
}

From source file:gobblin.data.management.copy.OwnerAndPermission.java

License:Apache License

@Override
public void write(DataOutput dataOutput) throws IOException {
    Text.writeString(dataOutput, this.owner);
    Text.writeString(dataOutput, this.group);
    this.fsPermission.write(dataOutput);
}

From source file:gr.ntua.h2rdf.inputFormat.MyFileSplit.java

License:Open Source License

public void write(DataOutput out) throws IOException {
    Text.writeString(out, file.toString());
    out.writeLong(start);
    out.writeLong(length);
}

From source file:infinidb.hadoop.example.InfiniDoopRecord.java

License:Apache License

public void write(DataOutput out) throws IOException {
    out.writeLong(this.id);
    Text.writeString(out, this.name);
}

From source file:io.amient.kafka.hadoop.io.KafkaInputSplit.java

License:Apache License

public void write(DataOutput out) throws IOException {
    Text.writeString(out, brokerId);
    Text.writeString(out, broker);
    Text.writeString(out, topic);
    out.writeInt(partition);/*w  w  w.  j  a  v a2s .c  o  m*/
    out.writeLong(startOffset);
}

From source file:io.confluent.connect.hdfs.wal.WALEntry.java

License:Apache License

@Override
public void write(DataOutput out) throws IOException {
    Text.writeString(out, name);
}

From source file:io.hops.erasure_coding.PolicyInfo.java

License:Apache License

public void write(DataOutput out) throws IOException {
    if (srcPath == null) {
        Text.writeString(out, "");
    } else {//from  w  ww.j a  va  2s. co  m
        Text.writeString(out, srcPath.toString());
    }
    Text.writeString(out, policyName);
    Text.writeString(out, codecId);
    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));
    }
}

From source file:it.crs4.pydoop.mapreduce.pipes.BinaryProtocol.java

License:Apache License

public void authenticate(String digest, String challenge) throws IOException {
    LOG.debug("Sending AUTHENTICATION_REQ, digest=" + digest + ", challenge=" + challenge);
    WritableUtils.writeVInt(stream, MessageType.AUTHENTICATION_REQ.code);
    Text.writeString(stream, digest);
    Text.writeString(stream, challenge);
}

From source file:it.crs4.pydoop.mapreduce.pipes.BinaryProtocol.java

License:Apache License

public void setJobConf(Configuration conf) throws IOException {
    WritableUtils.writeVInt(stream, MessageType.SET_JOB_CONF.code);
    List<String> list = new ArrayList<String>();
    for (Map.Entry<String, String> itm : conf) {
        list.add(itm.getKey());//from w w w . ja va  2 s .  c  o m
        list.add(itm.getValue());
    }
    WritableUtils.writeVInt(stream, list.size());
    for (String entry : list) {
        Text.writeString(stream, entry);
    }
}

From source file:it.crs4.pydoop.mapreduce.pipes.BinaryProtocol.java

License:Apache License

public void setInputTypes(String keyType, String valueType) throws IOException {
    WritableUtils.writeVInt(stream, MessageType.SET_INPUT_TYPES.code);
    Text.writeString(stream, keyType);
    Text.writeString(stream, valueType);
}