public static Writable getWritable(final byte[] bytes, final int offset, final int length,
    final Writable w) throws IOException {
    if (bytes == null || length <= 0) {
      throw new IllegalArgumentException("Can't build a writable with empty " + "bytes array");
    }
    if (w == null) {
      throw new IllegalArgumentException("Writable cannot be null");
    }
    DataInputBuffer in = new DataInputBuffer();
    try {
      in.reset(bytes, offset, length);
      w.readFields(in);
      return w;
    } finally {
      in.close();
    }
  }
Set bytes into the passed Writable by calling its
{@link Writable#readFields(java.io.DataInput)}.
@param bytes  serialized bytes
@param offset offset into array
@param length length of data
@param w      An empty Writable (usually made by calling the null-arg constructor).
@return The passed Writable after its readFields has been called fed by the passed
        <code>bytes</code> array or IllegalArgumentException if passed null or an empty
        <code>bytes</code> array.
@throws IOException e
hbase-client/src/main/java/org/apache/hadoop/hbase/util/Writables.java