use of com.amazon.ion.impl._Private_IonSystem in project ion-java by amzn.
the class IonTestCase method newSystem.
/**
* Returns a new IonSystem for each call, using the passed in IonCatalog
* to build the IonSystem.
*
* @param catalog
* the catalog to use when building the IonSystem
*
* @return
* a new IonSystem instance, stream-copy optimized depending on the
* injected {@link #myStreamCopyOptimized}.
*/
protected _Private_IonSystem newSystem(IonCatalog catalog) {
IonSystemBuilder b = IonSystemBuilder.standard().withCatalog(catalog);
b.withStreamCopyOptimized(myStreamCopyOptimized);
b.withReaderBuilder(getStreamingMode().getReaderBuilder());
IonSystem system = b.build();
return (_Private_IonSystem) system;
}
use of com.amazon.ion.impl._Private_IonSystem in project ion-java by amzn.
the class TextIteratorSystemProcessingTest method systemIterate.
@Override
protected Iterator<IonValue> systemIterate() throws Exception {
_Private_IonSystem sys = system();
Iterator<IonValue> it = sys.systemIterate(myText);
return it;
}
use of com.amazon.ion.impl._Private_IonSystem in project ion-java by amzn.
the class Printer method print.
// =========================================================================
// Print methods
public void print(IonValue value, Appendable out) throws IOException {
// Copy the options so visitor won't see changes made while printing.
Options options;
synchronized (// So we don't clone in the midst of changes
this) {
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();
}
}
use of com.amazon.ion.impl._Private_IonSystem in project ion-java by amzn.
the class DatagramTest method testAutomaticIVM.
@Test
public void testAutomaticIVM() throws Exception {
_Private_IonSystem system = system();
SymbolTable systemSymtab_1_0 = system.getSystemSymbolTable(ION_1_0);
IonDatagram dg = system.newDatagram();
IonNull v = system.newNull();
assertTrue(v.getSymbolTable() == null || v.getSymbolTable().isSystemTable());
dg.add(v);
IonValue sysId = dg.systemGet(0);
checkSymbol(ION_1_0, ION_1_0_SID, sysId);
assertSame(systemSymtab_1_0, sysId.getSymbolTable());
assertSame(systemSymtab_1_0, v.getSymbolTable());
}
use of com.amazon.ion.impl._Private_IonSystem in project ion-java by amzn.
the class DatagramTest method testManualIVM.
@Test
public void testManualIVM() throws Exception {
_Private_IonSystem system = system();
SymbolTable systemSymtab_1_0 = system.getSystemSymbolTable(ION_1_0);
IonDatagram dg = system.newDatagram();
IonSymbol sysId = system.newSymbol(ION_1_0);
assertTrue(sysId.getSymbolTable() == null || sysId.getSymbolTable().isSystemTable());
// $ion_1_0 at the front top-level is a systemId
dg.add(sysId);
assertSame(systemSymtab_1_0, sysId.getSymbolTable());
// TODO amzn/ion-java/issues/20
// assertEquals(0, dg.size());
// TODO adding $ion_1_1 should fail: unsupported version
}
Aggregations