你好:我想知道如何编写一个异步表迭代器。假设输入表由很多行组成,当接收到该表时,它是序列化的格式。当接收到表时,迭代器被调用以一行一行地检索。
它通过以下方式执行读取和反序列化: 1) 它首先读取关于行大小的整数并将其反序列化。2) 然后它读取并反序列化该行的内容,其中,a。时间戳首先通过调用 in.readint(), b 准备好。然后读取和反序列化该行的每个键,c。然后读取和反序列化有关非键列的位图字符串。d. 然后调用 in.readint() 读取并反序列化表示非键列数的整数,然后读取并反序列化每个非键列。3) 最后它读取并反序列化文件结束标记,该标记指示是否到达文件末尾。
最后它返回反序列化的行。
这是代码
enter code here
public Row next() {
/* It first reads the integer about the size of the row and
deserialize it. */
int size = in.readInt();
/*Then it reads and deserialize the contents of the row*/
Row row = Row.deserialize(descriptor, in);
/*Finally it reads and deserializes the file end marker, which
indicates if the end of the file is reached.*/
int signal = in.readInt();
if …Run Code Online (Sandbox Code Playgroud) java ×1