List of usage examples for org.apache.hadoop.io Text writeString
public static int writeString(DataOutput out, String s) throws IOException
From source file:com.digitalpebble.behemoth.BehemothDocument.java
License:Apache License
public void writeCommon(DataOutput out) throws IOException { out.writeByte(CUR_VERSION); // write version Text.writeString(out, url); // write url if (content == null) out.writeInt(0); // write content else {//from w w w . j a va 2s . c om out.writeInt(content.length); // write content out.write(content); } if (contentType != null) { Text.writeString(out, contentType); // write contentType } else { Text.writeString(out, ""); } out.writeBoolean(text != null); if (text != null) Text.writeString(out, text); // write text out.writeBoolean(metadata != null); if (metadata != null) metadata.write(out); // write metadata; }
From source file:com.digitalpebble.behemoth.BehemothDocument.java
License:Apache License
private void writeAnnotations(DataOutput out) throws IOException { List<String> atypes = new ArrayList<String>(); if (annotations != null) { // go through the annotations and check the annotation types that // are present for (int i = 0; i < annotations.size(); i++) { Annotation annot = annotations.get(i); if (atypes.contains(annot.getType()) == false) atypes.add(annot.getType()); Iterator<String> featNamIter = annot.getFeatures().keySet().iterator(); while (featNamIter.hasNext()) { String fn = featNamIter.next(); if (atypes.contains(fn) == false) atypes.add(fn);/*from w ww . j a v a2 s . com*/ } } } out.writeInt(atypes.size()); // write the annotation type and feature names // to the output for (String type : atypes) { Text.writeString(out, type); } // write annotations if (annotations == null) out.writeInt(0); else out.writeInt(annotations.size()); if (annotations != null) { for (int i = 0; i < annotations.size(); i++) { Annotation annot = annotations.get(i); writeAnnotation(annot, out, atypes); } } }
From source file:com.ebay.erl.mobius.core.model.WriteImpl.java
License:Apache License
@Override protected Void on_string() throws IOException { String str = (String) value; Text.writeString(out, str); return null; }
From source file:com.ebay.erl.mobius.core.model.WriteImpl.java
License:Apache License
@SuppressWarnings("unchecked") @Override//ww w . ja v a2 s . c o m protected Void on_string_map() throws IOException { out.writeInt(((Map) value).size()); for (Entry<String, String> e : (Set<Entry<String, String>>) ((Map<String, String>) value).entrySet()) { Text.writeString(out, e.getKey()); Text.writeString(out, e.getValue()); } return null; }
From source file:com.emadbarsoum.lib.Tuple.java
License:Apache License
/** Writes each Writable to <code>out</code>. * Tuple format:/*from ww w. ja v a2s . c o m*/ * {@code * <count><type1><type2>...<typen><obj1><obj2>...<objn> * } */ public void write(DataOutput out) throws IOException { WritableUtils.writeVInt(out, values.length); WritableUtils.writeVLong(out, written); for (int i = 0; i < values.length; ++i) { Text.writeString(out, values[i].getClass().getName()); } for (int i = 0; i < values.length; ++i) { if (has(i)) { values[i].write(out); } } }
From source file:com.flipkart.fdp.migration.distcp.config.ConnectionConfig.java
License:Apache License
@Override public void write(DataOutput out) throws IOException { Text.writeString(out, getUserName()); Text.writeString(out, getUserPassword()); Text.writeString(out, getKeyFile()); Text.writeString(out, getConnectionURL()); Text.writeString(out, String.valueOf(securityType)); out.writeLong(getFreeSpaceInBytes()); Text.writeString(out, getPath()); }
From source file:com.fullcontact.sstable.hadoop.mapreduce.SSTableSplit.java
License:Apache License
@Override public void write(DataOutput out) throws IOException { Text.writeString(out, file.toString()); out.writeLong(length);/*from w ww. j a va 2 s .c om*/ out.writeLong(start); out.writeLong(end); }
From source file:com.hortonworks.hbase.replication.bridge.ConnectionHeader.java
License:Apache License
@Override public void write(DataOutput out) throws IOException { Text.writeString(out, (protocol == null) ? "" : protocol); }
From source file:com.ibm.bi.dml.runtime.matrix.data.hadoopfix.TaggedInputSplit.java
License:Apache License
public void write(DataOutput out) throws IOException { Text.writeString(out, inputSplitClass.getName()); inputSplit.write(out);//from w w w . j a v a 2s. c o m Text.writeString(out, inputFormatClass.getName()); Text.writeString(out, mapperClass.getName()); }
From source file:com.iflytek.spider.parse.ParseText.java
License:Apache License
public final void write(DataOutput out) throws IOException { out.write(VERSION); Text.writeString(out, text); }