org.apache.hudi.org.apache.hadoop.hbase.types.StructIterator Maven / Gradle / Ivy
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.hbase.types;
import java.util.Iterator;
import java.util.NoSuchElementException;
import org.apache.hadoop.hbase.util.PositionedByteRange;
import org.apache.yetus.audience.InterfaceAudience;
/**
* An {@link Iterator} over encoded {@code Struct} members.
*
* This iterates over each serialized {@code Struct} field from the specified
* {@code DataTypes[]} definition. It allows you to read the field or skip
* over its serialized bytes using {@link #next()} and {@link #skip()},
* respectively. This is in contrast to the {@code Struct} method which allow
* you to {@link Struct#decode(PositionedByteRange)} or
* {@link Struct#skip(PositionedByteRange)} over the entire {@code Struct} at
* once.
*
*
* This iterator may also be used to read bytes from any {@code Struct} for
* which the specified {@code DataType[]} is a prefix. For example, if the
* specified {@code Struct} definition has a {@link RawInteger} and a
* {@link RawStringTerminated} field, you may parse the serialized output
* of a {@code Struct} whose fields are {@link RawInteger},
* {@link RawStringTerminated}, and {@link RawBytes}. The iterator would
* return a number followed by a {@code String}. The trailing {@code byte[]}
* would be ignored.
*
*/
@InterfaceAudience.Public
public class StructIterator implements Iterator