public static String convertUTF8WithBuf(byte[] buf, char[] out, int offset,
      int utfSize) throws UTFDataFormatException {
    int count = 0, s = 0, a;
    while (count < utfSize) {
      if ((out[s] = (char) buf[offset + count++]) < '\u0080') {
        s++;
      } else if (((a = out[s]) & 0xe0) == 0xc0) {
        if (count >= utfSize) {
          throw new UTFDataFormatException();
        }
        int b = buf[count++];
        if ((b & 0xC0) != 0x80) {
          throw new UTFDataFormatException();
        }
        out[s++] = (char) (((a & 0x1F) << 6) | (b & 0x3F));
      } else if ((a & 0xf0) == 0xe0) {
        if (count + 1 >= utfSize) {
          throw new UTFDataFormatException();
        }
        int b = buf[count++];
        int c = buf[count++];
        if (((b & 0xC0) != 0x80) || ((c & 0xC0) != 0x80)) {
          throw new UTFDataFormatException();
        }
        out[s++] = (char) (((a & 0x0F) << 12) | ((b & 0x3F) << 6) | (c & 0x3F));
      } else {
        throw new UTFDataFormatException();
      }
    }
    return new String(out, 0, s);
  }
Skips <code>count</code> number of bytes in this stream. Subsequent
<code>read()</code>'s will not return these bytes unless
<code>reset()</code> is used.

@param count
         the number of bytes to skip.
@return the number of bytes actually skipped.

@throws IOException
          If the stream is already closed or another IOException occurs.
ql/src/java/org/apache/hadoop/hive/ql/io/NonSyncDataInputBuffer.java