private static int writeSize(CstString value) {
    int utf16Size = value.getUtf16Size();

    // The +1 is for the '\0' termination byte.
    return Leb128.unsignedLeb128Size(utf16Size) + value.getUtf8Size() + 1;
  }
Gets the write size for a given value.

@param value {@code non-null;} the string value
@return {@code >= 2}; the write size, in bytes
android/android_framework/dex-maker/src/main/java/com/android/dx/dex/file/StringDataItem.java