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.terrier.structures.indexing.BlockDocumentPostingList.java
License:Mozilla Public License
@Override public void write(final DataOutput out) throws IOException { WritableUtils.writeVInt(out, getNumberOfPointers()); try {//from ww w . j a va 2 s .c o m this.forEachTerm(new TObjectIntProcedure<String>() { public boolean execute(String term, int freq) { try { Text.writeString(out, term); WritableUtils.writeVInt(out, freq); final int[] blocks = term_blocks.get(term).toArray(); Arrays.sort(blocks); final int bf = blocks.length; WritableUtils.writeVInt(out, bf); if (bf == 0) return true; WritableUtils.writeVInt(out, blocks[0] + 1); for (int i = 1; i < bf; i++) WritableUtils.writeVInt(out, blocks[i] - blocks[i - 1]); } catch (IOException e) { throw new Error(e); } return true; } }); } catch (Error e) { throw (IOException) e.getCause(); } }
From source file:org.terrier.structures.indexing.DocumentPostingList.java
License:Mozilla Public License
public void write(final DataOutput out) throws IOException { WritableUtils.writeVInt(out, getNumberOfPointers()); try {// w ww. j a v a 2 s. com this.forEachTerm(new TObjectIntProcedure<String>() { public boolean execute(String term, int freq) { try { Text.writeString(out, term); WritableUtils.writeVInt(out, freq); } catch (IOException e) { throw new Error(e); } return true; } }); } catch (Error e) { throw (IOException) e.getCause(); } }
From source file:org.terrier.structures.indexing.singlepass.hadoop.NewSplitEmittedTerm.java
License:Mozilla Public License
/** * Write out this Term key to output stream 'out' *//*w w w.j a va 2 s . c o m*/ @Override public void write(DataOutput out) throws IOException { if (USE_HADOOP_TEXT) Text.writeString(out, term); else out.writeUTF(term); WritableUtils.writeVInt(out, splitno); WritableUtils.writeVInt(out, flushno); }
From source file:org.terrier.structures.indexing.singlepass.hadoop.SplitEmittedTerm.java
License:Mozilla Public License
/** * Write out this Term key to output stream 'out' *//*from www. ja v a 2 s. c o m*/ public void write(DataOutput out) throws IOException { if (USE_HADOOP_TEXT) Text.writeString(out, term); else out.writeUTF(term); WritableUtils.writeVInt(out, splitno); WritableUtils.writeVInt(out, flushno); }
From source file:org.vilcek.hive.kv.KVHiveInputSplit.java
License:Apache License
@Override public void write(DataOutput out) throws IOException { super.write(out); out.writeInt(kvHelperHosts.length);/*from w ww .j a v a 2s .c o m*/ for (int i = 0; i < kvHelperHosts.length; i++) { Text.writeString(out, kvHelperHosts[i]); } Text.writeString(out, kvStore); Text.writeString(out, "" + kvPart); Text.writeString(out, (direction == null ? "" : direction.name())); out.writeInt(batchSize); writeBytes(out, (parentKey == null ? null : parentKey.toByteArray())); writeBytes(out, (subRange == null ? null : subRange.toByteArray())); Text.writeString(out, (depth == null ? "" : depth.name())); writeBytes(out, (consistency == null ? null : consistency.toByteArray())); out.writeLong(timeout); Text.writeString(out, (timeoutUnit == null ? "" : timeoutUnit.name())); out.writeInt(locations.length); for (int i = 0; i < locations.length; i++) { Text.writeString(out, locations[i]); } }
From source file:org.voltdb.hadoop.VoltRecord.java
License:Open Source License
/** * Serializes itself to the given {@linkplain DataOutput} stream * It looks up the adapters cache for the data adapters associated * with this record's table name./*from w ww . j a v a 2 s. c om*/ */ @Override public void write(DataOutput out) throws IOException { DataAdapters adapters = DataAdapters.adaptersFor(m_table, null); if (adapters == null) { throw new IOException("no adapters configured for table " + m_table); } Text.writeString(out, m_table); adapters.forOutput().adapt(out, this); }
From source file:org.vsw.knowledge.ie.candidate.Candidate.java
License:Open Source License
public void write(DataOutput out) throws IOException { Text.writeString(out, source); Text.writeString(out, entity); Text.writeString(out, text);/*from w ww . j a v a2 s . c o m*/ }
From source file:org.wonderbee.elasticsearch.ElasticSearchSplit.java
License:Apache License
@Override public void write(DataOutput out) throws IOException { out.writeInt(shard);// w ww.jav a 2 s .c o m out.writeLong(from); out.writeLong(size); Text.writeString(out, host); Text.writeString(out, nodeName); Text.writeString(out, tableLocation); }