List of usage examples for org.apache.hadoop.io Text writeString
public static int writeString(DataOutput out, String s) throws IOException
From source file:PairOfStrings.java
License:Apache License
/** * Serializes this pair.//from w ww.ja va2 s .com * * @param out where to write the raw byte representation */ public void write(DataOutput out) throws IOException { Text.writeString(out, leftElement); Text.writeString(out, rightElement); }
From source file:Counter.java
License:Apache License
/** * Write the binary representation of the counter *//*from ww w . ja v a 2 s . com*/ @Override public synchronized void write(DataOutput out) throws IOException { Text.writeString(out, name); boolean distinctDisplayName = !name.equals(displayName); out.writeBoolean(distinctDisplayName); if (distinctDisplayName) { Text.writeString(out, displayName); } WritableUtils.writeVLong(out, value); }
From source file:at.illecker.hama.hybrid.examples.kmeans.CenterMessage.java
License:Apache License
@Override public final void write(DataOutput out) throws IOException { String str = centerIndex + ":" + incrementCounter + ":"; for (int i = 0; i < newCenter.getLength(); i++) { str += (i < newCenter.getLength() - 1) ? newCenter.get(i) + ", " : newCenter.get(i); }/*from ww w .ja va 2s. c o m*/ Text.writeString(out, str); }
From source file:at.illecker.hama.hybrid.examples.onlinecf.ItemMessage.java
License:Apache License
public static void writeItemMessage(ItemMessage itemMessage, DataOutput out) throws IOException { String str = itemMessage.senderId + VALUE_DELIMITER + itemMessage.itemId + VALUE_DELIMITER; DoubleVector vector = itemMessage.getVector(); for (int i = 0; i < vector.getLength(); i++) { str += (i < vector.getLength() - 1) ? vector.get(i) + VALUE_DELIMITER : vector.get(i); }//ww w. ja va 2s. c om Text.writeString(out, str); }
From source file:babel.content.pages.MetaData.java
License:Apache License
public void write(DataOutput out) throws IOException { Text.writeString(out, m_typeLabel); m_metadata.write(out); }
From source file:babel.content.pages.Page.java
License:Apache License
public void write(DataOutput out) throws IOException { Text.writeString(out, m_pageURL); m_pageProps.write(out);/*from w w w.j a v a 2 s . c om*/ WritableUtils.writeVInt(out, m_versions.size()); for (PageVersion ver : m_versions) { ver.write(out); } }
From source file:babel.content.pages.PageVersion.java
License:Apache License
public void write(DataOutput out) throws IOException { m_verProps.write(out);/*from w w w .j a v a2 s .c o m*/ m_contentMeta.write(out); m_parseMeta.write(out); int numLinks = (m_outLinks == null) ? 0 : m_outLinks.length; WritableUtils.writeVInt(out, numLinks); for (int i = 0; i < numLinks; i++) { m_outLinks[i].write(out); } Text.writeString(out, m_content); }
From source file:babel.prep.extract.NutchChunk.java
License:Apache License
public void write(DataOutput out) throws IOException { Text.writeString(out, m_segmentId); super.write(out); }
From source file:boa.io.EmitKey.java
License:Apache License
/** {@inheritDoc} */ @Override/*w w w . j a va2 s . c o m*/ public void write(final DataOutput out) throws IOException { out.writeInt(this.id); Text.writeString(out, this.index); Text.writeString(out, this.name); }
From source file:boa.io.EmitValue.java
License:Apache License
/** {@inheritDoc} */ @Override//from w w w.j a v a2 s. c om public void write(final DataOutput out) throws IOException { out.writeInt(this.data.length); for (final String d : this.data) Text.writeString(out, d); if (this.metadata == null) Text.writeString(out, ""); else Text.writeString(out, this.metadata); }