ByteBufCodedInputStream.java 文件源码

java
阅读 29 收藏 0 点赞 0 评论 0

项目:incubator-pulsar 作者:
/**
 * Reads and discards a single field, given its tag value.
 *
 * @return {@code false} if the tag is an endgroup tag, in which case nothing is skipped. Otherwise, returns
 *         {@code true}.
 */
public boolean skipField(final int tag) throws IOException {
    switch (getTagWireType(tag)) {
    case WireFormat.WIRETYPE_VARINT:
        readInt32();
        return true;
    case WireFormat.WIRETYPE_FIXED64:
        readRawLittleEndian64();
        return true;
    case WireFormat.WIRETYPE_LENGTH_DELIMITED:
        skipRawBytes(readRawVarint32());
        return true;
    case WireFormat.WIRETYPE_START_GROUP:
        skipMessage();
        checkLastTagWas(makeTag(WireFormat.getTagFieldNumber(tag), WireFormat.WIRETYPE_END_GROUP));
        return true;
    case WireFormat.WIRETYPE_END_GROUP:
        return false;
    case WireFormat.WIRETYPE_FIXED32:
        readRawLittleEndian32();
        return true;
    default:
        throw new InvalidProtocolBufferException("Protocol message tag had invalid wire type.");
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号