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)
| 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 | //========================================================================= |
no test coverage detected