Search in sources :

Example 1 with SymbolTable

use of com.amazon.ion.SymbolTable in project ion-java by amzn.

the class BinaryWriterTest method flushUnlockedSymtab.

private byte[] flushUnlockedSymtab(boolean lstAppendEnabled) throws Exception {
    myLstAppendEnabled = lstAppendEnabled;
    iw = makeWriter();
    iw.writeSymbol("force a local symtab");
    SymbolTable symtab = iw.getSymbolTable();
    symtab.intern("fred_1");
    symtab.intern("fred_2");
    iw.writeSymbol("fred_1");
    iw.flush();
    return myOutputStream.toByteArray();
}
Also used : SymbolTable(com.amazon.ion.SymbolTable)

Example 2 with SymbolTable

use of com.amazon.ion.SymbolTable in project ion-java by amzn.

the class BinaryWriterTest method flushUnlockedSymtabWithImports.

private byte[] flushUnlockedSymtabWithImports(SimpleCatalog catalog, boolean lstAppendEnabled) throws Exception {
    SymbolTable fred1 = Symtabs.register("fred", 1, catalog);
    myLstAppendEnabled = lstAppendEnabled;
    iw = makeWriter(fred1);
    iw.writeSymbol("fred_1");
    // This would cause an appended LST to be written before the next value.
    iw.flush();
    return myOutputStream.toByteArray();
}
Also used : SymbolTable(com.amazon.ion.SymbolTable)

Example 3 with SymbolTable

use of com.amazon.ion.SymbolTable in project ion-java by amzn.

the class BinaryWriterWithLocalSymtabsTest method testConstructionWithSharedSymtab.

@Test(expected = IllegalArgumentException.class)
public void testConstructionWithSharedSymtab() throws Exception {
    SymbolTable fred1 = Symtabs.register("fred", 1, catalog());
    makeBinaryWriterWithLocalSymbols(fred1);
}
Also used : SymbolTable(com.amazon.ion.SymbolTable) Test(org.junit.Test)

Example 4 with SymbolTable

use of com.amazon.ion.SymbolTable in project ion-java by amzn.

the class BinaryWriterWithLocalSymtabsTest method testConstructionWithNoLocalSymbolsAndOneImports.

@Test
public void testConstructionWithNoLocalSymbolsAndOneImports() throws Exception {
    String[] localSymbols = EMPTY_STRING_ARRAY;
    SymbolTable fred1 = Symtabs.register("fred", 1, catalog());
    checkConstructionWithLocalSymbolsAndImports(localSymbols, fred1);
}
Also used : SymbolTable(com.amazon.ion.SymbolTable) Test(org.junit.Test)

Example 5 with SymbolTable

use of com.amazon.ion.SymbolTable in project ion-java by amzn.

the class BinaryWriterWithLocalSymtabsTest method testConstructionWithSystemSymtab.

// ==========================================================================
@Test
public void testConstructionWithSystemSymtab() throws Exception {
    SymbolTable systemSymtab = system().getSystemSymbolTable();
    // This is okay!
    makeBinaryWriterWithLocalSymbols(systemSymtab);
}
Also used : SymbolTable(com.amazon.ion.SymbolTable) Test(org.junit.Test)

Aggregations

SymbolTable (com.amazon.ion.SymbolTable)177 Test (org.junit.Test)105 IonValue (com.amazon.ion.IonValue)21 IonDatagram (com.amazon.ion.IonDatagram)18 com.amazon.ion.impl._Private_Utils.copyLocalSymbolTable (com.amazon.ion.impl._Private_Utils.copyLocalSymbolTable)17 SymbolToken (com.amazon.ion.SymbolToken)14 IonStruct (com.amazon.ion.IonStruct)13 ByteArrayOutputStream (java.io.ByteArrayOutputStream)13 IonWriter (com.amazon.ion.IonWriter)12 SimpleCatalog (com.amazon.ion.system.SimpleCatalog)12 IonReader (com.amazon.ion.IonReader)11 IonSystem (com.amazon.ion.IonSystem)10 IOException (java.io.IOException)9 IonType (com.amazon.ion.IonType)8 ArrayList (java.util.ArrayList)7 IonException (com.amazon.ion.IonException)6 com.amazon.ion.impl._Private_IonBinaryWriterBuilder (com.amazon.ion.impl._Private_IonBinaryWriterBuilder)6 com.amazon.ion.impl.bin._Private_IonRawWriter (com.amazon.ion.impl.bin._Private_IonRawWriter)6 IonCatalog (com.amazon.ion.IonCatalog)5 IonList (com.amazon.ion.IonList)5