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:org.apache.nutch.parse.Outlink.java

License:Apache License

public void write(DataOutput out) throws IOException {
    Text.writeString(out, toUrl);
    Text.writeString(out, anchor);
}

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

License:Apache License

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 . java2 s.  com
    }
    contentMeta.write(out); // write content metadata
    parseMeta.write(out);
}

From source file:org.apache.nutch.protocol.Content.java

License:Apache License

public final void write(DataOutput out) throws IOException {
    out.writeInt(VERSION);/*from www  . j  a  v a  2s .com*/

    Text.writeString(out, url); // write url
    Text.writeString(out, base); // write base

    out.writeInt(content.length); // write content
    out.write(content);

    Text.writeString(out, contentType); // write contentType

    metadata.write(out); // write metadata
}

From source file:org.apache.nutch.scoring.ScoreDatum.java

License:Apache License

@Override
public void write(DataOutput out) throws IOException {
    out.writeFloat(score);/*from  w w  w . ja v  a  2s .c o  m*/
    Text.writeString(out, url);
    Text.writeString(out, anchor);
    WritableUtils.writeVInt(out, distance);

    WritableUtils.writeVInt(out, metaData.size());
    for (Entry<String, byte[]> e : metaData.entrySet()) {
        Text.writeString(out, e.getKey());
        Bytes.writeByteArray(out, e.getValue());
    }
}

From source file:org.apache.nutch.scoring.webgraph.LinkDatum.java

License:Apache License

public void write(DataOutput out) throws IOException {
    Text.writeString(out, url);
    Text.writeString(out, anchor != null ? anchor : "");
    out.writeFloat(score);//from ww  w.ja  v  a 2s.c  om
    out.writeLong(timestamp);
    out.writeByte(linkType);
}

From source file:org.apache.nutch.searcher.Hits.java

License:Apache License

public void write(DataOutput out) throws IOException {
    out.writeLong(total); // write total hits
    out.writeInt(top.length); // write hits returned
    if (top.length > 0) // write sort value class
        Text.writeString(out, top[0].getSortValue().getClass().getName());

    for (int i = 0; i < top.length; i++) {
        Hit h = top[i];//from w  w  w . ja  v  a  2 s.c  o  m
        out.writeInt(h.getIndexDocNo()); // write indexDocNo
        h.getSortValue().write(out); // write sortValue
        Text.writeString(out, h.getDedupValue()); // write dedupValue         
    }
}

From source file:org.apache.nutch.searcher.Summary.java

License:Apache License

public void write(DataOutput out) throws IOException {
    out.writeInt(fragments.size());//w  w w .  j  a  va 2  s .c  o  m
    Fragment fragment = null;
    for (int i = 0; i < fragments.size(); i++) {
        fragment = (Fragment) fragments.get(i);
        if (fragment.isHighlight()) {
            out.writeByte(HIGHLIGHT);
            Text.writeString(out, fragment.getText());
        } else if (fragment.isEllipsis()) {
            out.writeByte(ELLIPSIS);
        } else {
            out.writeByte(FRAGMENT);
            Text.writeString(out, fragment.getText());
        }
    }
}

From source file:org.apache.nutch.util.hostdb.HostDatum.java

License:Apache License

@Override
public void write(DataOutput out) throws IOException {
    out.writeByte(CUR_VERSION); // store current version
    out.writeFloat(score);//w w  w . ja v a2s .co  m
    out.writeLong(lastCheck.getTime());
    Text.writeString(out, homepageUrl);

    out.writeInt(dnsFailures);
    out.writeInt(connectionFailures);

    out.writeInt(statCounts.get(CrawlDatum.STATUS_DB_UNFETCHED));
    out.writeInt(statCounts.get(CrawlDatum.STATUS_DB_FETCHED));
    out.writeInt(statCounts.get(CrawlDatum.STATUS_DB_NOTMODIFIED));
    out.writeInt(statCounts.get(CrawlDatum.STATUS_DB_REDIR_PERM));
    out.writeInt(statCounts.get(CrawlDatum.STATUS_DB_REDIR_TEMP));
    out.writeInt(statCounts.get(CrawlDatum.STATUS_DB_GONE));

    metaData.write(out);
}

From source file:org.apache.phoenix.hive.HivePhoenixInputSplit.java

License:Apache License

public void write(DataOutput output) throws IOException {
    Preconditions.checkNotNull(this.keyRange);
    Text.writeString(output, path.toString());
    this.keyRange.write(output);
}

From source file:org.apache.pig.piggybank.squeal.backend.storm.state.CombineTupleWritable.java

License:Apache License

@Override
public void write(DataOutput out) throws IOException {
    WritableUtils.writeVInt(out, values.size());
    for (int i = 0; i < values.size(); ++i) {
        Text.writeString(out, values.get(i).getClass().getName());
    }/*from   w  ww  .  j  a  v  a  2s .  c  o m*/
    for (int i = 0; i < values.size(); ++i) {
        values.get(i).write(out);
    }
}