use of com.amazon.ion.IonCatalog in project ion-java by amzn.
the class IonSystemLite method newDatagram.
public IonDatagram newDatagram() {
IonCatalog catalog = this.getCatalog();
IonDatagram dg = newDatagram(catalog);
return dg;
}
use of com.amazon.ion.IonCatalog in project ion-java by amzn.
the class IonSystemBuilder method build.
// =========================================================================
/**
* Builds a new {@link IonSystem} instance based on this builder's
* configuration properties.
*/
public final IonSystem build() {
IonCatalog catalog = (myCatalog != null ? myCatalog : new SimpleCatalog());
IonTextWriterBuilder twb = IonTextWriterBuilder.standard().withCharsetAscii();
twb.setCatalog(catalog);
_Private_IonBinaryWriterBuilder bwb = _Private_IonBinaryWriterBuilder.standard();
bwb.setCatalog(catalog);
bwb.setStreamCopyOptimized(myStreamCopyOptimized);
// TODO Would be nice to remove this since it's implied by the BWB.
// However that currently causes problems in the IonSystem
// constructors (which get a null initialSymtab).
SymbolTable systemSymtab = _Private_Utils.systemSymtab(1);
bwb.setInitialSymbolTable(systemSymtab);
// This is what we need, more or less.
// bwb = bwb.fillDefaults();
IonReaderBuilder rb = readerBuilder == null ? IonReaderBuilder.standard() : readerBuilder;
rb = rb.withCatalog(catalog);
return newLiteSystem(twb, bwb, rb);
}
use of com.amazon.ion.IonCatalog in project ion-java by amzn.
the class IonReaderBuilderTest method testMutable.
@Test
public void testMutable() {
IonCatalog catalog = new SimpleCatalog();
IonReaderBuilder mutable = IonReaderBuilder.standard().withCatalog(catalog);
assertSame(catalog, mutable.getCatalog());
IonReaderBuilder mutableSame = mutable.withCatalog(new SimpleCatalog());
assertNotSame(catalog, mutable.getCatalog());
assertSame(mutable, mutableSame);
}
use of com.amazon.ion.IonCatalog in project ion-java by amzn.
the class IonReaderBuilderTest method testMutateCopiedMutable.
@Test
public void testMutateCopiedMutable() {
IonCatalog catalog = new SimpleCatalog();
IonReaderBuilder mutable = IonReaderBuilder.standard().withCatalog(catalog);
IonReaderBuilder mutableCopy = mutable.copy();
assertNotSame(mutable, mutable.immutable());
assertNotSame(mutable, mutableCopy);
assertSame(mutable, mutable.mutable());
assertSame(catalog, mutableCopy.getCatalog());
IonReaderBuilder mutableSame = mutableCopy.withCatalog(new SimpleCatalog());
assertNotSame(catalog, mutableCopy.getCatalog());
assertSame(mutableCopy, mutableSame);
}
use of com.amazon.ion.IonCatalog in project ion-java by amzn.
the class IonSystemBuilderTest method testFluidStyle.
// -------------------------------------------------------------------------
@Test
public void testFluidStyle() {
IonCatalog catalog = new SimpleCatalog();
IonSystem ion = IonSystemBuilder.standard().withCatalog(catalog).withStreamCopyOptimized(true).build();
assertSame(catalog, ion.getCatalog());
}
Aggregations