use of com.amazon.ion.impl._Private_IonBinaryWriterBuilder in project ion-java by amzn.
the class IonBinaryWriterBuilderTest method testImmutableInitialSymtab.
@Test
public void testImmutableInitialSymtab() {
SymbolTable sst = _Private_Utils.systemSymtab(1);
// Immutable local symtabs shouldn't get copied.
SymbolTable lst = Symtabs.localSymbolTableFactory().newLocalSymtab(sst);
lst.intern("hello");
lst.makeReadOnly();
_Private_IonBinaryWriterBuilder b = _Private_IonBinaryWriterBuilder.standard();
b.setInitialSymbolTable(lst);
assertSame(lst, b.getInitialSymbolTable());
OutputStream out = new ByteArrayOutputStream();
IonWriter writer = b.build(out);
assertTrue(symbolTableEquals(lst, writer.getSymbolTable()));
writer = b.build(out);
assertTrue(symbolTableEquals(lst, writer.getSymbolTable()));
}
use of com.amazon.ion.impl._Private_IonBinaryWriterBuilder in project ion-java by amzn.
the class IonBinaryWriterBuilderTest method testInitialSymtabImmutability.
@Test(expected = UnsupportedOperationException.class)
public void testInitialSymtabImmutability() {
_Private_IonBinaryWriterBuilder b = _Private_IonBinaryWriterBuilder.standard();
b.setInitialSymbolTable(null);
_Private_IonBinaryWriterBuilder b2 = b.immutable();
b2.setInitialSymbolTable(null);
}
use of com.amazon.ion.impl._Private_IonBinaryWriterBuilder 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.impl._Private_IonBinaryWriterBuilder in project ion-java by amzn.
the class IonBinaryWriterBuilderTest method testSymtabValueFactory.
// -------------------------------------------------------------------------
@Test
public void testSymtabValueFactory() {
IonSystem system = IonSystemBuilder.standard().build();
_Private_IonBinaryWriterBuilder b = _Private_IonBinaryWriterBuilder.standard();
b.setSymtabValueFactory(system);
assertSame(system, b.getSymtabValueFactory());
// The value factory isn't visible through other APIs so we can't
// really test any further.
}
use of com.amazon.ion.impl._Private_IonBinaryWriterBuilder in project ion-java by amzn.
the class IonBinaryWriterBuilderTest method testSymtabValueFactoryImmutability.
@Test(expected = UnsupportedOperationException.class)
public void testSymtabValueFactoryImmutability() {
_Private_IonBinaryWriterBuilder b = _Private_IonBinaryWriterBuilder.standard();
b.setSymtabValueFactory(IonSystemBuilder.standard().build());
_Private_IonBinaryWriterBuilder b2 = b.immutable();
b2.setSymtabValueFactory(null);
}
Aggregations