use of com.amazon.ion.IonDatagram in project ion-java by amzn.
the class RoundTripStreamingTest method makeTree.
private IonDatagram makeTree(byte[] buffer) throws IOException {
IonReader in = makeIterator(buffer);
IonDatagram dg = system().newDatagram();
IonWriter tw = system().newTreeWriter(dg);
tw.writeValues(in);
// IonValue v = tw.getContentAsIonValue();
in.close();
return dg;
}
use of com.amazon.ion.IonDatagram in project ion-java by amzn.
the class SeekableReaderTest method testWalkingBackwards.
@Test
public void testWalkingBackwards() {
if (getStreamingMode() == StreamingMode.NEW_STREAMING_INCREMENTAL) {
// See ion-java/issues/382 and ion-java/issues/383.
return;
}
String text = "null true 3 4e0 5.0 6666-06-06T '7' \"8\" {{\"\"}} {{}} [] () {}";
IonDatagram dg = loader().load(text);
Span[] positions = new Span[dg.size()];
read(text);
for (int i = 0; i < dg.size(); i++) {
assertEquals(dg.get(i).getType(), in.next());
positions[i] = sr.currentSpan();
}
expectEof();
checkSpans(dg, positions);
// Collect spans *after* extracting scalar body.
read(text);
for (int i = 0; i < dg.size(); i++) {
IonType t = in.next();
assertEquals(dg.get(i).getType(), t);
if (!IonType.isContainer(t)) {
TestUtils.consumeCurrentValue(in);
}
positions[i] = sr.currentSpan();
}
expectTopEof();
checkSpans(dg, positions);
}
Aggregations