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:cn.edu.hfut.dmic.webcollectorcluster.model.Content.java

@Override
public void write(DataOutput d) throws IOException {
    Text.writeString(d, contentType);
    d.writeInt(content.length);
    d.write(content);
}

From source file:cn.edu.hfut.dmic.webcollectorcluster.model.CrawlDatum.java

License:Open Source License

@Override
public void write(DataOutput d) throws IOException {
    Text.writeString(d, url);
    d.writeInt(status);
    d.writeLong(fetchTime);
}

From source file:cn.edu.hfut.dmic.webcollectorcluster.model.Link.java

License:Open Source License

@Override
public void write(DataOutput d) throws IOException {
    Text.writeString(d, anchor);
    Text.writeString(d, url);

}

From source file:cn.edu.hfut.dmic.webcollectorcluster.parser.ParseData.java

License:Open Source License

@Override
public void write(DataOutput d) throws IOException {
    Text.writeString(d, url);
    d.writeInt(links.size());//from w w  w  . ja  v  a2 s .  co  m
    for (int i = 0; i < links.size(); i++) {
        links.get(i).write(d);
    }
}

From source file:cn.edu.jnu.ie.backend.NutchDocument.java

License:Apache License

public void write(DataOutput out) throws IOException {
    out.writeByte(VERSION);/*from   www .  j a  v a  2 s .c  o m*/
    WritableUtils.writeVInt(out, fields.size());
    for (Map.Entry<String, NutchField> entry : fields.entrySet()) {
        Text.writeString(out, entry.getKey());
        NutchField field = entry.getValue();
        field.write(out);
    }
    out.writeFloat(weight);
}

From source file:cn.edu.jnu.ie.backend.NutchField.java

License:Apache License

public void write(DataOutput out) throws IOException {
    out.writeFloat(weight);//w w  w .  j  a va 2  s  .c  o  m
    out.writeInt(values.size());
    for (Object value : values) {

        Text.writeString(out, value.getClass().getName());

        if (value instanceof Boolean) {
            out.writeBoolean((Boolean) value);
        } else if (value instanceof Integer) {
            out.writeInt((Integer) value);
        } else if (value instanceof Long) {
            out.writeLong((Long) value);
        } else if (value instanceof Float) {
            out.writeFloat((Float) value);
        } else if (value instanceof String) {
            Text.writeString(out, (String) value);
        } else if (value instanceof Date) {
            Date date = (Date) value;
            out.writeLong(date.getTime());
        }
    }
}

From source file:co.cask.cdap.etl.batch.mapreduce.TaggedWritable.java

License:Apache License

@Override
public void write(DataOutput out) throws IOException {
    Text.writeString(out, stageName);
    ObjectWritable recordWritable = new ObjectWritable(record);
    recordWritable.write(out);//from w w w.  jav a  2 s  .com
}

From source file:co.cask.cdap.internal.app.runtime.batch.dataset.DataSetInputSplit.java

License:Apache License

@Override
public void write(final DataOutput out) throws IOException {
    Text.writeString(out, split.getClass().getName());
    String ser = new Gson().toJson(split);
    Text.writeString(out, ser);/*from  w w w.j  av  a2 s  . c  o  m*/
}

From source file:co.cask.cdap.internal.app.runtime.batch.dataset.input.MultiInputTaggedSplit.java

License:Apache License

@Override
protected void writeAdditionalFields(DataOutput out) throws IOException {
    Text.writeString(out, name);
    Text.writeString(out, mapperClassName);
    Text.writeString(out, GSON.toJson(inputConfigs));
    Text.writeString(out, inputFormatClass.getName());
}

From source file:co.cask.cdap.internal.app.runtime.batch.dataset.input.TaggedInputSplit.java

License:Apache License

@SuppressWarnings("unchecked")
@Override//from   www  . j  a va  2s. com
public void write(DataOutput out) throws IOException {
    Text.writeString(out, name);
    Text.writeString(out, inputSplitClass.getName());
    Text.writeString(out, inputFormatClass.getName());
    Text.writeString(out, mapperClassName);
    Text.writeString(out, GSON.toJson(inputConfigs));
    SerializationFactory factory = new SerializationFactory(conf);
    Serializer serializer = factory.getSerializer(inputSplitClass);
    serializer.open((DataOutputStream) out);
    serializer.serialize(inputSplit);
}