List of usage examples for org.apache.hadoop.io WritableUtils writeString
public static void writeString(DataOutput out, String s) throws IOException
From source file:com.facebook.hiveio.common.Writables.java
License:Apache License
/** * Write a Map<String, String>/*from ww w.j a va2s. c o m*/ * * @param out DataOutput * @param map Map to write * @throws IOException I/O errors */ public static void writeStrStrMap(DataOutput out, Map<String, String> map) throws IOException { out.writeInt(map.size()); for (Map.Entry<String, String> entry : map.entrySet()) { WritableUtils.writeString(out, entry.getKey()); WritableUtils.writeString(out, entry.getValue()); } }
From source file:com.facebook.hiveio.common.Writables.java
License:Apache License
/** * Write a Map<String, Integer>// w w w. j a va2 s .c o m * * @param out DataOutput * @param map Map to write * @throws IOException I/O errors */ public static void writeStrIntMap(DataOutput out, Map<String, Integer> map) throws IOException { out.writeInt(map.size()); for (Map.Entry<String, Integer> entry : map.entrySet()) { WritableUtils.writeString(out, entry.getKey()); out.writeInt(entry.getValue()); } }
From source file:com.facebook.hiveio.common.Writables.java
License:Apache License
/** * Write a List<String>/*from w w w . j a v a2 s . co m*/ * * @param out DataOutput * @param data list of strings * @throws IOException I/O errors */ public static void writeStringList(DataOutput out, List<String> data) throws IOException { out.writeInt(data.size()); for (String s : data) { WritableUtils.writeString(out, s); } }
From source file:com.facebook.hiveio.common.Writables.java
License:Apache License
/** * Write a Hive FieldSchema to output/*w w w. j a va 2 s .c o m*/ * * @param out DataOutput * @param fs FieldSchema * @throws IOException I/O errors */ public static void writeFieldSchema(DataOutput out, FieldSchema fs) throws IOException { WritableUtils.writeString(out, fs.getName()); WritableUtils.writeString(out, fs.getType()); }
From source file:com.facebook.hiveio.input.HiveInputDescription.java
License:Apache License
@Override public void write(DataOutput out) throws IOException { metastoreDesc.write(out);/* w w w . j a v a2s .c om*/ tableDesc.write(out); Writables.writeStringList(out, columns); WritableUtils.writeString(out, partitionFilter); out.writeInt(numSplits); }
From source file:com.facebook.hiveio.input.InputPartition.java
License:Apache License
@Override public void write(DataOutput out) throws IOException { Writables.writeClassName(out, Preconditions.checkNotNull(inputFormatClass)); WritableUtils.writeString(out, Preconditions.checkNotNull(location)); inputSplitData.write(out);/* w w w .j a v a 2s . c o m*/ }
From source file:com.facebook.hiveio.output.OutputInfo.java
License:Apache License
@Override public void write(DataOutput out) throws IOException { Writables.writeClassName(out, Preconditions.checkNotNull(outputFormatClass)); Writables.writeFieldSchemas(out, partitionInfo); Writables.writeStrStrMap(out, tableParams); Writables.writeFieldSchemas(out, columnInfo); WritableUtils.writeString(out, Preconditions.checkNotNull(tableRoot)); WritableUtils.writeString(out, Preconditions.checkNotNull(partitionPath)); WritableUtils.writeString(out, Preconditions.checkNotNull(finalOutputPath)); Writables.writeClassName(out, Preconditions.checkNotNull(serializerClass)); Writables.writeStrStrMap(out, serializerParams); }
From source file:com.jfolson.hive.serde.RTypedBytesOutput.java
License:Apache License
/** * Writes a string as a typed bytes sequence. * * @param s// w ww . j av a 2s . co m * the string to be written * @throws IOException */ public void writeRawString(String s) throws IOException { WritableUtils.writeString(out, s); }
From source file:com.jfolson.hive.serde.RTypedBytesOutput.java
License:Apache License
/** * Writes a string as a typed bytes sequence. * * @param s//from w w w . j a v a 2 s .c o m * the string to be written * @throws IOException */ public void writeString(String s) throws IOException { out.write(RType.STRING.code); WritableUtils.writeString(out, s); }
From source file:com.jfolson.hive.serde.RTypedBytesWritableOutput.java
License:Apache License
public void writeWritable(Writable w) throws IOException { DataOutputStream dos = null;//from w w w. ja v a2 s . c o m try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); dos = new DataOutputStream(baos); WritableUtils.writeString(dos, w.getClass().getName()); w.write(dos); out.writeBytes(baos.toByteArray(), RType.WRITABLE.code); dos.close(); dos = null; } finally { IOUtils.closeStream(dos); } }