示例#1
0
 /** Write a UTF8 encoded string to out */
 public static int writeString(DataOutput out, String s) throws IOException {
   ByteBuffer bytes = encode(s);
   int length = bytes.limit();
   WritableUtils.writeVInt(out, length);
   out.write(bytes.array(), 0, length);
   return length;
 }
示例#2
0
 /**
  * serialize write this object to out length uses zero-compressed encoding
  *
  * @see Writable#write(DataOutput)
  */
 public void write(DataOutput out) throws IOException {
   WritableUtils.writeVInt(out, length);
   out.write(bytes, 0, length);
 }