ProtoListUtil.java 文件源码

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

项目:OpenYOLO-Android 作者:
/**
 * Reads a list of protos, using the provided parser, from the provided input stream.
 * @throws IOException if the proto list could not be parsed.
 */
public static <T extends MessageLite> List<T> readMessageList(
        InputStream stream,
        Parser<T> parser)
        throws IOException {
    DataInputStream dis = new DataInputStream(stream);
    int messageCount = dis.readInt();

    ArrayList<T> messages = new ArrayList<>(messageCount);
    for (int i = 0; i < messageCount; i++) {
        messages.add(parser.parseDelimitedFrom(stream));
    }

    return messages;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号