use of com.amazon.ion.IonSystem in project ion-java by amzn.
the class SymbolTableTest method testSymtabImageMaintenance.
@Test
public void testSymtabImageMaintenance() {
IonSystem system = system();
SymbolTable st = ((_Private_ValueFactory) system).getLstFactory().newLocalSymtab(system.getSystemSymbolTable());
st.intern("foo");
IonStruct image = symtabTree(st, system);
st.intern("bar");
image = symtabTree(st, system);
IonList symbols = (IonList) image.get(SYMBOLS);
assertEquals("[\"foo\",\"bar\"]", symbols.toString());
}
use of com.amazon.ion.IonSystem in project ion-java by amzn.
the class IonReaderBinaryIncrementalTest method incrementalMultipleValuesIterateFromInputStream.
@Test
public void incrementalMultipleValuesIterateFromInputStream() throws Exception {
ResizingPipedInputStream pipe = new ResizingPipedInputStream(128);
IonSystem system = IonSystemBuilder.standard().withReaderBuilder(STANDARD_READER_BUILDER).build();
Iterator<IonValue> iterator = system.iterate(pipe);
incrementalMultipleValuesIterate(iterator, pipe);
}
use of com.amazon.ion.IonSystem in project ion-java by amzn.
the class _Private_IonTextWriterBuilder method build.
/**
* Assumes that {@link #fillDefaults()} has been called.
*/
private IonWriter build(_Private_FastAppendable appender) {
IonCatalog catalog = getCatalog();
SymbolTable[] imports = getImports();
// TODO We shouldn't need a system here
IonSystem system = IonSystemBuilder.standard().withCatalog(catalog).build();
SymbolTable defaultSystemSymtab = system.getSystemSymbolTable();
IonWriterSystemText systemWriter = (getCallbackBuilder() == null ? new IonWriterSystemText(defaultSystemSymtab, this, appender) : new IonWriterSystemTextMarkup(defaultSystemSymtab, this, appender));
SymbolTable initialSymtab = initialSymtab(((_Private_ValueFactory) system).getLstFactory(), defaultSystemSymtab, imports);
return new IonWriterUser(catalog, system, systemWriter, initialSymtab);
}
use of com.amazon.ion.IonSystem in project ion-java by amzn.
the class _Private_IonWriterFactory method makeSystemWriter.
/**
* @param container must not be null.
*/
public static IonWriter makeSystemWriter(IonContainer container) {
IonSystem sys = container.getSystem();
IonCatalog cat = sys.getCatalog();
SymbolTable defaultSystemSymtab = sys.getSystemSymbolTable();
IonWriter writer = new IonWriterSystemTree(defaultSystemSymtab, cat, container, null);
return writer;
}
use of com.amazon.ion.IonSystem in project ion-java by amzn.
the class _Private_IonWriterFactory method makeWriter.
/**
* @param container must not be null.
*/
public static IonWriter makeWriter(IonCatalog catalog, IonContainer container) {
IonSystem sys = container.getSystem();
SymbolTable defaultSystemSymtab = sys.getSystemSymbolTable();
// TODO the SUPPRESS here is a nasty discontinuity with other places
// that create this kind of reader. It prevents the Lite DG system
// iterator from returning two IVMs at the start of the data.
// The Span tests detect that problem.
IonWriterSystemTree system_writer = new IonWriterSystemTree(defaultSystemSymtab, catalog, container, InitialIvmHandling.SUPPRESS);
return new IonWriterUser(catalog, sys, system_writer);
}
Aggregations