List of usage examples for org.apache.hadoop.io Text writeString
public static int writeString(DataOutput out, String s) throws IOException
From source file:org.apache.mrql.MR_string.java
License:Apache License
final public void write(DataOutput out) throws IOException { out.writeByte(MRContainer.STRING); Text.writeString(out, value); }
From source file:org.apache.nutch.crawl.Inlink.java
License:Apache License
public void write(DataOutput out) throws IOException { Text.writeString(out, fromUrl); Text.writeString(out, anchor); }
From source file:org.apache.nutch.crawl.MapWritable.java
License:Apache License
public void write(DataOutput out) throws IOException { out.writeInt(size());//from ww w . j a v a2s . co m if (size() > 0) { // scan for unknown classes; createInternalIdClassEntries(); // write internal map out.writeByte(fIdCount); if (fIdCount > 0) { ClassIdEntry entry = fIdFirst; while (entry != null) { out.writeByte(entry.fId); Text.writeString(out, entry.fclazz.getName()); entry = entry.fNextIdEntry; } } // write meta data KeyValueEntry entry = fFirst; while (entry != null) { out.writeByte(entry.fKeyClassId); out.writeByte(entry.fValueClassId); entry.fKey.write(out); entry.fValue.write(out); entry = entry.fNextEntry; } } }
From source file:org.apache.nutch.fetch.data.FetchEntry.java
License:Apache License
@Override public void write(DataOutput out) throws IOException { Text.writeString(out, key); IOUtils.serialize(getConf(), out, page, WebPage.class); }
From source file:org.apache.nutch.hostdb.HostDatum.java
License:Apache License
@Override public void write(DataOutput out) throws IOException { out.writeFloat(score);/* w w w . j ava 2 s . co m*/ out.writeLong(lastCheck.getTime()); Text.writeString(out, homepageUrl); out.writeLong(dnsFailures); out.writeLong(connectionFailures); out.writeLong(unfetched); out.writeLong(fetched); out.writeLong(notModified); out.writeLong(redirTemp); out.writeLong(redirPerm); out.writeLong(gone); metaData.write(out); }
From source file:org.apache.nutch.indexer.field.FieldWritable.java
License:Apache License
public void write(DataOutput out) throws IOException { Text.writeString(out, name); Text.writeString(out, value); Text.writeString(out, type.toString()); out.writeFloat(boost);//from ww w . java2 s .c om out.writeBoolean(indexed); out.writeBoolean(stored); out.writeBoolean(tokenized); }
From source file:org.apache.nutch.indexer.IndexDocument.java
License:Apache License
public void write(DataOutput out) throws IOException { out.writeByte(VERSION);// ww w . j av a2 s.com WritableUtils.writeVInt(out, fields.size()); for (Map.Entry<String, IndexField> entry : fields.entrySet()) { Text.writeString(out, entry.getKey()); IndexField field = entry.getValue(); field.write(out); } out.writeFloat(weight); documentMeta.write(out); }
From source file:org.apache.nutch.indexer.IndexField.java
License:Apache License
@Override public void write(DataOutput out) throws IOException { out.writeFloat(weight);/*from www . j av a 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:org.apache.nutch.indexer.NutchDocument.java
License:Apache License
public void write(DataOutput out) throws IOException { out.writeByte(VERSION);/*from w ww . j a v a2 s . co m*/ WritableUtils.writeVInt(out, fields.size()); for (Map.Entry<String, List<String>> entry : fields.entrySet()) { Text.writeString(out, entry.getKey()); List<String> values = entry.getValue(); WritableUtils.writeVInt(out, values.size()); for (String value : values) { Text.writeString(out, value); } } out.writeFloat(score); documentMeta.write(out); }
From source file:org.apache.nutch.metadata.Metadata.java
License:Apache License
public final void write(DataOutput out) throws IOException { out.writeInt(size());/*from w ww . ja v a2 s .c o m*/ String[] values = null; String[] names = names(); for (int i = 0; i < names.length; i++) { Text.writeString(out, names[i]); values = _getValues(names[i]); int cnt = 0; for (int j = 0; j < values.length; j++) { if (values[j] != null) cnt++; } out.writeInt(cnt); for (int j = 0; j < values.length; j++) { if (values[j] != null) { Text.writeString(out, values[j]); } } } }