Search in sources :

Example 6 with IonSexp

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

the class _Private_CurriedValueFactory method newSexp.

public IonSexp newSexp(long[] values) {
    IonSexp v = myFactory.newSexp(values);
    handle(v);
    return v;
}
Also used : IonSexp(com.amazon.ion.IonSexp)

Example 7 with IonSexp

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

the class _Private_CurriedValueFactory method newSexp.

public IonSexp newSexp(IonValue... values) throws ContainedValueException, NullPointerException {
    IonSexp v = myFactory.newSexp(values);
    handle(v);
    return v;
}
Also used : IonSexp(com.amazon.ion.IonSexp)

Example 8 with IonSexp

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

the class _Private_CurriedValueFactory method newEmptySexp.

public IonSexp newEmptySexp() {
    IonSexp v = myFactory.newEmptySexp();
    handle(v);
    return v;
}
Also used : IonSexp(com.amazon.ion.IonSexp)

Example 9 with IonSexp

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

the class _Private_CurriedValueFactory method newNullSexp.

// -------------------------------------------------------------------------
public IonSexp newNullSexp() {
    IonSexp v = myFactory.newNullSexp();
    handle(v);
    return v;
}
Also used : IonSexp(com.amazon.ion.IonSexp)

Example 10 with IonSexp

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

the class OptimizedBinaryWriterLengthPatchingTest method testOptimizedWriteLengthPatching.

/**
 * Tests that the internal implementation of binary {@link IonWriter}'s
 * patching mechanism is correct.
 *
 * @see IonWriterSystemBinary
 */
@Test
public void testOptimizedWriteLengthPatching() throws Exception {
    iw = makeWriter();
    // The expected datagram - as values are copied to the IonWriter, we
    // book-keep the values written so as to do an equality check at the end.
    IonDatagram expected = system().newDatagram();
    // === top level ===
    writeAndAddTypeDescLengthVariants(expected);
    // === nested list ===
    iw.stepIn(IonType.LIST);
    IonList expectedNestedList = expected.add().newEmptyList();
    {
        writeAndAddTypeDescLengthVariants(expectedNestedList);
    }
    iw.stepOut();
    // === nested sexp ===
    iw.stepIn(IonType.SEXP);
    IonSexp expectedNestedSexp = expected.add().newEmptySexp();
    {
        writeAndAddTypeDescLengthVariants(expectedNestedSexp);
    }
    iw.stepOut();
    // === nested struct ===
    iw.stepIn(IonType.STRUCT);
    IonStruct expectedNestedStruct = expected.add().newEmptyStruct();
    {
        writeAndAddTypeDescLengthVariants(expectedNestedStruct);
    }
    iw.stepOut();
    // === deeply nested list ===
    iw.stepIn(IonType.LIST);
    IonList nestedList1 = expected.add().newEmptyList();
    {
        writeAndAddTypeDescLengthVariants(nestedList1);
        iw.stepIn(IonType.LIST);
        {
            IonList nestedList2 = nestedList1.add().newEmptyList();
            writeAndAddTypeDescLengthVariants(nestedList2);
        }
        iw.stepOut();
    }
    iw.stepOut();
    IonDatagram actual = loader().load(outputByteArray());
    assertIonEquals(expected, actual);
}
Also used : IonStruct(com.amazon.ion.IonStruct) IonSexp(com.amazon.ion.IonSexp) IonDatagram(com.amazon.ion.IonDatagram) IonList(com.amazon.ion.IonList) Test(org.junit.Test)

Aggregations

IonSexp (com.amazon.ion.IonSexp)13 Test (org.junit.Test)4 IonList (com.amazon.ion.IonList)3 IonStruct (com.amazon.ion.IonStruct)3 BlobTest (com.amazon.ion.BlobTest)2 ClobTest (com.amazon.ion.ClobTest)2 IntTest (com.amazon.ion.IntTest)2 IonBlob (com.amazon.ion.IonBlob)2 IonClob (com.amazon.ion.IonClob)2 IonNull (com.amazon.ion.IonNull)2 IonTimestamp (com.amazon.ion.IonTimestamp)2 IonBool (com.amazon.ion.IonBool)1 IonDatagram (com.amazon.ion.IonDatagram)1 IonDecimal (com.amazon.ion.IonDecimal)1 IonException (com.amazon.ion.IonException)1 IonFloat (com.amazon.ion.IonFloat)1 IonInt (com.amazon.ion.IonInt)1 IonString (com.amazon.ion.IonString)1 IonSymbol (com.amazon.ion.IonSymbol)1 Timestamp (com.amazon.ion.Timestamp)1