MCPcopy Create free account
hub / github.com/amazon-ion/ion-java / loadOneValue

Method loadOneValue

src/test/java/com/amazon/ion/LoaderTest.java:50–68  ·  view source on GitHub ↗

Parses text as a single Ion value. If the text contains more than that, a failure is thrown. @param text must not be null . @return a single value, not null .

(String text)

Source from the content-addressed store, hash-verified

48 * @return a single value, not <code>null</code>.
49 */
50 public IonValue loadOneValue(String text)
51 {
52 IonDatagram dg = loader().load(text);
53
54 if (dg.size() == 0)
55 {
56 fail("No user values in text: " + text);
57 }
58
59 if (dg.size() > 1)
60 {
61 IonValue part = dg.get(1);
62 fail("Found unexpected part <" + part + "> in text: " + text);
63 }
64
65 IonValue value = dg.get(0);
66 dg.remove(value);
67 return value;
68 }
69
70
71 //=========================================================================

Callers 5

testLoadOneValueMethod · 0.95
testLargeSidSymbolMethod · 0.95

Calls 6

sizeMethod · 0.95
getMethod · 0.95
loaderMethod · 0.80
failMethod · 0.80
loadMethod · 0.65
removeMethod · 0.65

Tested by

no test coverage detected