docs: private void prepareValue()
      {
          if (isInStruct() && currentFieldSid == null)
          {
              throw new IllegalStateException("IonWriter.setFieldName() must be called before writing a value into a struct.");
          }
          if (currentFieldSid != null)
          {
              checkSid(currentFieldSid);
              writeVarUInt(currentFieldSid);
  
              // clear out field name
              currentFieldSid = null;
          }
          if (!currentAnnotationSids.isEmpty())
          {
              // we have to push a container context for annotations
              updateLength(preallocationMode.typedLength);
              pushContainer(ContainerType.ANNOTATION);
              buffer.writeBytes(preallocationMode.annotationsTypedPreallocatedBytes);
  
              final long annotationsLengthPosition = buffer.position();
              buffer.writeVarUInt(0L);
              int annotationsLength = 0;
              for (final int symbol : currentAnnotationSids)
              {
                  checkSid(symbol);
                  final int symbolLength = buffer.writeVarUInt(symbol);
                  annotationsLength += symbolLength;
              }
              if (annotationsLength > MAX_ANNOTATION_LENGTH)
              {
                  // TODO deal with side patching if we want to support > 32 4-byte symbols annotations... seems excessive
                  throw new IonException("Annotations too large: " + currentAnnotationSids);
              }
  
              // update the annotations size
              updateLength(/*length specifier*/ 1 + annotationsLength);
              // patch the annotations length
              buffer.writeVarUIntDirect1At(annotationsLengthPosition, annotationsLength);
  
              // clear out annotations
              currentAnnotationSids.clear();
              hasTopLevelSymbolTableAnnotation = false;
          }
      }