private void prepareValue(){
  if (isInStruct() && currentFieldName == null) {
    throw new IllegalStateException("IonWriter.setFieldName() must be called before writing a value into a struct.");
  }
  if (currentFieldName != null) {
    writeVarUInt(checkSid(currentFieldName));
    currentFieldName=null;
  }
  if (!currentAnnotations.isEmpty()) {
    updateLength(preallocationMode.typedLength);
    pushContainer(ContainerType.ANNOTATION);
    buffer.writeBytes(preallocationMode.annotationsTypedPreallocatedBytes);
    final long annotationsLengthPosition=buffer.position();
    buffer.writeVarUInt(0L);
    int annotationsLength=0;
    for (    final SymbolToken symbol : currentAnnotations) {
      final int sid=checkSid(symbol);
      final int symbolLength=buffer.writeVarUInt(sid);
      annotationsLength+=symbolLength;
    }
    if (annotationsLength > MAX_ANNOTATION_LENGTH) {
      throw new IonException("Annotations too large: " + currentAnnotations);
    }
    updateLength(1 + annotationsLength);
    buffer.writeVarUIntDirect1At(annotationsLengthPosition,annotationsLength);
    currentAnnotations.clear();
    hasTopLevelSymbolTableAnnotation=false;
  }
}

private void prepareValue ( ) { if ( isInStruct ( ) && currentFieldName == null ) { throw new IllegalStateException ( "IonWriter.setFieldName() must be called before writing a value into a struct." ) ; } if ( currentFieldName != null ) { writeVarUInt ( checkSid ( currentFieldName ) ) ; currentFieldName = null ; } if ( ! currentAnnotations . isEmpty ( ) ) { updateLength ( preallocationMode . typedLength ) ; pushContainer ( ContainerType . ANNOTATION ) ; buffer . writeBytes ( preallocationMode . annotationsTypedPreallocatedBytes ) ; final long annotationsLengthPosition = buffer . position ( ) ; buffer . writeVarUInt ( 0L ) ; int annotationsLength = 0 ; for ( final SymbolToken symbol : currentAnnotations ) { final int sid = checkSid ( symbol ) ; final int symbolLength = buffer . writeVarUInt ( sid ) ; annotationsLength += symbolLength ; } if ( annotationsLength > MAX_ANNOTATION_LENGTH ) { throw new IonException ( "Annotations too large: " + currentAnnotations ) ; } updateLength ( 1 + annotationsLength ) ; buffer . writeVarUIntDirect1At ( annotationsLengthPosition , annotationsLength ) ; currentAnnotations . clear ( ) ; hasTopLevelSymbolTableAnnotation = false ; } }
prepare to write values with field name and annotations .
