public static long[] utf8Write(JSObject object, String str, int offset, int len) {
ByteBuf b = extract( object );
int origWriter = b.writerIndex();
byte[] bytes = str.getBytes( UTF8 );
b.writerIndex( offset );
len = Math.min( bytes.length, Math.min( len, bufLen(object) - offset ) );
b.writeBytes( bytes, 0, len );
b.writerIndex( Math.max( b.writerIndex(), origWriter ) );
return new long[] { str.length(), len };
}