public void print(IonValue value, Appendable out)
        throws IOException
    {
        // Copy the options so visitor won't see changes made while printing.
        Options options;
        synchronized (this)  // So we don't clone in the midst of changes
        {
            options = myOptions.clone();
        }

        if (true)
        {
            _print(value, makeVisitor(options, out));
        }
        else
        {
            // Bridge to the configurable text writer. This is here for
            // testing purposes. It *almost* works except for printing
            // datagram as list.

            boolean dg = value instanceof IonDatagram;

            _Private_IonTextWriterBuilder o =
                _Private_IonTextWriterBuilder.standard();
            o.setCharset(IonTextWriterBuilder.ASCII);
            if (dg)
            {
                if (options.skipSystemValues)
                {
                    o.withMinimalSystemData();
                }
                else if (options.simplifySystemValues) {

                    o.setIvmMinimizing(IvmMinimizing.DISTANT);
                    o.setLstMinimizing(LstMinimizing.LOCALS);
                }
            }

            o._blob_as_string      = options.blobAsString;
            o._clob_as_string      = options.clobAsString;
            o._decimal_as_float    = options.decimalAsFloat;
            // TODO datagram as list
            o._sexp_as_list        = options.sexpAsList;
            o._skip_annotations    = options.skipAnnotations;
            o._string_as_json      = options.stringAsJson;
            o._symbol_as_string    = options.symbolAsString;
            o._timestamp_as_millis = options.timestampAsMillis;
            o._timestamp_as_string = options.timestampAsString;
            o._untyped_nulls       = options.untypedNulls;

            IonWriter writer = o.build(out);
            // TODO doesn't work for datagram since it skips system values
            // value.writeTo(writer);
            _Private_IonSystem system = (_Private_IonSystem) value.getSystem();
            IonReader reader = system.newSystemReader(value);
            writer.writeValues(reader);
            writer.finish();
        }
    }
public void print ( IonValue value , Appendable out ) throws IOException { Options options ; synchronized ( this ) { options = myOptions . clone ( ) ; } if ( true ) { _print ( value , makeVisitor ( options , out ) ) ; } else { boolean dg = value instanceof IonDatagram ; _Private_IonTextWriterBuilder o = _Private_IonTextWriterBuilder . standard ( ) ; o . setCharset ( IonTextWriterBuilder . ASCII ) ; if ( dg ) { if ( options . skipSystemValues ) { o . withMinimalSystemData ( ) ; } else if ( options . simplifySystemValues ) { o . setIvmMinimizing ( IvmMinimizing . DISTANT ) ; o . setLstMinimizing ( LstMinimizing . LOCALS ) ; } } o . _blob_as_string = options . blobAsString ; o . _clob_as_string = options . clobAsString ; o . _decimal_as_float = options . decimalAsFloat ; o . _sexp_as_list = options . sexpAsList ; o . _skip_annotations = options . skipAnnotations ; o . _string_as_json = options . stringAsJson ; o . _symbol_as_string = options . symbolAsString ; o . _timestamp_as_millis = options . timestampAsMillis ; o . _timestamp_as_string = options . timestampAsString ; o . _untyped_nulls = options . untypedNulls ; IonWriter writer = o . build ( out ) ; _Private_IonSystem system = ( _Private_IonSystem ) value . getSystem ( ) ; IonReader reader = system . newSystemReader ( value ) ; writer . writeValues ( reader ) ; writer . finish ( ) ; } }
Print methods