Provides stream-based access to Ion data independent of its underlying representation (text, binary, or IonValue tree). WARNING: This interface should not be implemented or extended by code outside of this library. We still have some work to do before this interface is stable. See
| 141 | * This facet is supported by all readers of Ion text data. |
| 142 | */ |
| 143 | public interface IonReader |
| 144 | extends Closeable, Faceted |
| 145 | { |
| 146 | |
| 147 | /** |
| 148 | * Determines whether there is another value at the current depth; |
| 149 | * in other words whether there is a sibling value that may be reached |
| 150 | * using {@link #next()}. |
| 151 | * This method may be |
| 152 | * called multiple times, which does not move the current position. |
| 153 | * <p> |
| 154 | * <b>WARNING:</b> this method alters the internal state of the reader such |
| 155 | * that you cannot reliably get values from the "current" element. The only |
| 156 | * thing you should call after {@code hasNext()} is {@link #next()}! |
| 157 | * |
| 158 | * @deprecated Applications should detect the end of the current level by |
| 159 | * checking for a {@code null} response from {@link #next()}. |
| 160 | */ |
| 161 | @Deprecated |
| 162 | public boolean hasNext(); |
| 163 | |
| 164 | /** |
| 165 | * Positions this reader on the next sibling after the current value, |
| 166 | * returning the type of that value. Once so positioned the contents of |
| 167 | * this value can be accessed with the {@code *Value()} methods. |
| 168 | * <p> |
| 169 | * A sequence of {@code next()} calls traverses the data at a constant |
| 170 | * depth, within the same container. |
| 171 | * Use {@link #stepIn()} to traverse down into any containers, and |
| 172 | * {@link #stepOut()} to traverse up to the parent container. |
| 173 | * |
| 174 | * @return the type of the next Ion value (never {@link IonType#DATAGRAM}), |
| 175 | * or {@code null} when there are no more elements at the current depth in |
| 176 | * the same container. |
| 177 | */ |
| 178 | public IonType next(); |
| 179 | |
| 180 | |
| 181 | /** |
| 182 | * Positions the reader just before the contents of the current value, |
| 183 | * which must be a container (list, sexp, or struct). |
| 184 | * There's no current value immediately after stepping in, so the next |
| 185 | * thing you'll want to do is call {@link #next()} to move onto the first |
| 186 | * child value (or learn that there's not one). |
| 187 | * <p> |
| 188 | * Stepping into a null container ({@code null.list}, {@code null.sexp}, |
| 189 | * or {@code null.struct}) behaves as if the container were empty |
| 190 | * ({@code []}, {@code ()}, or <code>{}</code>). |
| 191 | * <p> |
| 192 | * At any time {@link #stepOut()} may be called to move the cursor back to |
| 193 | * (just after) the parent value, even if there's more children remaining. |
| 194 | * |
| 195 | * @throws IllegalStateException if the current value isn't an Ion container. |
| 196 | */ |
| 197 | public void stepIn(); |
| 198 | |
| 199 | /** |
| 200 | * Positions the iterator after the current parent's value, moving up one |
no outgoing calls
no test coverage detected
searching dependent graphs…