List of usage examples for org.apache.hadoop.io Text readString
public static String readString(DataInput in) throws IOException
From source file:PairOfStrings.java
License:Apache License
/** * Deserializes the pair.//from w w w . ja v a2s . c o m * * @param in source for raw byte representation */ public void readFields(DataInput in) throws IOException { leftElement = Text.readString(in); rightElement = Text.readString(in); }
From source file:Counter.java
License:Apache License
/** * Read the binary representation of the counter *//* w ww .ja va2 s . c o m*/ @Override public synchronized void readFields(DataInput in) throws IOException { name = Text.readString(in); if (in.readBoolean()) { displayName = Text.readString(in); } else { displayName = name; } value = WritableUtils.readVLong(in); }
From source file:at.illecker.hama.hybrid.examples.kmeans.CenterMessage.java
License:Apache License
@Override public final void readFields(DataInput in) throws IOException { String str = Text.readString(in); String[] values = str.split(":", 3); centerIndex = Integer.parseInt(values[0]); incrementCounter = Integer.parseInt(values[1]); String[] vectorStr = values[2].split(","); int len = vectorStr.length; DoubleVector vector = new DenseDoubleVector(len); for (int i = 0; i < len; i++) { vector.set(i, Double.parseDouble(vectorStr[i])); }/* ww w. j av a2 s.c o m*/ newCenter = vector; }
From source file:at.illecker.hama.hybrid.examples.onlinecf.ItemMessage.java
License:Apache License
public static ItemMessage readItemMessage(DataInput in) throws IOException { String str = Text.readString(in); String[] values = str.split(VALUE_DELIMITER); int senderId = Integer.parseInt(values[0]); long itemId = Long.parseLong(values[1]); DoubleVector vector = new DenseDoubleVector(values.length - 2); for (int i = 0; i < values.length - 2; i++) { vector.set(i, Double.parseDouble(values[i + 2])); }//from w w w . j av a 2 s . com return new ItemMessage(senderId, itemId, vector); }
From source file:babel.content.pages.MetaData.java
License:Apache License
public void readFields(DataInput in) throws IOException { m_typeLabel = Text.readString(in); m_metadata.clear(); m_metadata.readFields(in); }
From source file:babel.content.pages.Page.java
License:Apache License
public void readFields(DataInput in) throws IOException { m_pageURL = Text.readString(in); m_pageProps.readFields(in);/*from www.j a v a2 s . c om*/ int numVersions = WritableUtils.readVInt(in); m_versions = new ArrayList<PageVersion>(numVersions); PageVersion curVer; for (int i = 0; i < numVersions; i++) { curVer = new PageVersion(); curVer.readFields(in); m_versions.add(curVer); } }
From source file:babel.content.pages.PageVersion.java
License:Apache License
public void readFields(DataInput in) throws IOException { m_verProps.readFields(in);/*www . j a v a2 s . com*/ m_contentMeta.readFields(in); m_parseMeta.readFields(in); int numLinks = WritableUtils.readVInt(in); m_outLinks = (numLinks == 0) ? null : new Outlink[numLinks]; for (int i = 0; i < numLinks; i++) { (m_outLinks[i] = new Outlink()).readFields(in); } m_content = Text.readString(in); }
From source file:babel.prep.extract.NutchChunk.java
License:Apache License
public void readFields(DataInput in) throws IOException { m_segmentId = Text.readString(in); super.readFields(in); }
From source file:boa.io.EmitKey.java
License:Apache License
/** {@inheritDoc} */ @Override//from w w w . java2 s .co m public void readFields(final DataInput in) throws IOException { this.id = in.readInt(); this.index = Text.readString(in); this.name = Text.readString(in); }
From source file:boa.io.EmitValue.java
License:Apache License
/** {@inheritDoc} */ @Override/* w w w . j a v a 2s.c om*/ public void readFields(final DataInput in) throws IOException { final int count = in.readInt(); this.data = new String[count]; for (int i = 0; i < count; i++) this.data[i] = Text.readString(in); final String metadata = Text.readString(in); if (metadata.equals("")) this.metadata = null; else this.metadata = metadata; }