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.cloudera.crunch.type.writable.GenericArrayWritable.java
License:Open Source License
public void write(DataOutput out) throws IOException { out.writeInt(values.length); // write values; if (values.length > 0) { if (valueClass == null) { throw new IllegalStateException("Value class not set by constructor or read"); }// www . j ava 2s .c o m Text.writeString(out, valueClass.getName()); for (int i = 0; i < values.length; i++) { values[i].write(out); } } }
From source file:com.cloudera.crunch.type.writable.TextMapWritable.java
License:Open Source License
@Override public void write(DataOutput out) throws IOException { Text.writeString(out, valueClazz.getName()); WritableUtils.writeVInt(out, instance.size()); for (Map.Entry<Text, T> e : instance.entrySet()) { e.getKey().write(out);//from w w w .j a va 2 s . com e.getValue().write(out); } }
From source file:com.cloudera.crunch.type.writable.TupleWritable.java
License:Apache License
/** * Writes each Writable to <code>out</code>. TupleWritable format: * {@code//from w w w . ja va2 s. co m * <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) { if (has(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.cloudera.sqoop.lib.BigDecimalSerializer.java
License:Apache License
public static void write(BigDecimal d, DataOutput out) throws IOException { int scale = d.scale(); BigInteger bigIntPart = d.unscaledValue(); boolean fastpath = bigIntPart.compareTo(LONG_MAX_AS_BIGINT) < 0 && bigIntPart.compareTo(LONG_MIN_AS_BIGINT) > 0; out.writeInt(scale);/*w ww .ja v a 2 s . c o m*/ out.writeBoolean(fastpath); if (fastpath) { out.writeLong(bigIntPart.longValue()); } else { Text.writeString(out, bigIntPart.toString()); } }
From source file:com.cloudera.sqoop.lib.ClobRef.java
License:Apache License
@Override public void writeInternal(DataOutput out) throws IOException { Text.writeString(out, getDataObj()); }
From source file:com.cloudera.sqoop.lib.LobRef.java
License:Apache License
@Override public void write(DataOutput out) throws IOException { out.writeBoolean(isExternal());// www . j ava2s .co m if (isExternal()) { Text.writeString(out, "lf"); // storage type "lf" for LobFile. Text.writeString(out, fileName); out.writeLong(offset); out.writeLong(length); } else { writeInternal(out); } }
From source file:com.cloudera.sqoop.mapreduce.MergeRecord.java
License:Apache License
@Override /**//from ww w. j av a 2s . co m * {@inheritDoc} */ public void write(DataOutput out) throws IOException { out.writeBoolean(this.isNew); Text.writeString(out, this.sqoopRecord.getClass().getName()); this.sqoopRecord.write(out); }
From source file:com.conversantmedia.mapreduce.input.FileLineWritable.java
License:Apache License
@Override public void write(DataOutput out) throws IOException { out.writeLong(offset); Text.writeString(out, fileName); }
From source file:com.datasalt.pangool.tuplemr.mapred.lib.input.FileSplit.java
License:Apache License
@Override public void write(DataOutput out) throws IOException { Text.writeString(out, file.toString()); out.writeLong(start); out.writeLong(length); }
From source file:com.datasalt.pangool.tuplemr.mapred.lib.input.TaggedInputSplit.java
License:Apache License
@SuppressWarnings("unchecked") public void write(DataOutput out) throws IOException { Text.writeString(out, inputSplitClass.getName()); Text.writeString(out, inputFormatFile); Text.writeString(out, inputProcessorFile); SerializationFactory factory = new SerializationFactory(conf); Serializer serializer = factory.getSerializer(inputSplitClass); serializer.open((DataOutputStream) out); serializer.serialize(inputSplit);//w w w .j a v a2s .c om }