org.apache.avro.io.Encoder.setItemCount()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(4.9k)|赞(0)|评价(0)|浏览(141)

本文整理了Java中org.apache.avro.io.Encoder.setItemCount()方法的一些代码示例,展示了Encoder.setItemCount()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Encoder.setItemCount()方法的具体详情如下:
包路径:org.apache.avro.io.Encoder
类名称:Encoder
方法名:setItemCount

Encoder.setItemCount介绍

[英]Call this method before writing a batch of items in an array or a map. Then for each item, call #startItem() followed by any of the other write methods of Encoder. The number of calls to #startItem() must be equal to the count specified in #setItemCount. Once a batch is completed you can start another batch with #setItemCount.
[中]在数组或映射中写入一批项之前调用此方法。然后对每个项调用#startItem(),然后调用编码器的任何其他写入方法。对#startItem()的调用数必须等于#setItemCount中指定的计数。完成一批后,您可以使用#setItemCount启动另一批。

代码示例

代码示例来源:origin: apache/avro

@Override
public void setItemCount(long itemCount) throws IOException {
 super.setItemCount(itemCount);
 out.setItemCount(itemCount);
}

代码示例来源:origin: org.apache.avro/avro

private void writeObjectArray(Schema element, Object[] data, Encoder out) throws IOException {
 int size = data.length;
 out.setItemCount(size);
 for (int i = 0; i < size; i++) {
  this.write(element, data[i], out);
 }
}

代码示例来源:origin: org.apache.avro/avro

@Override
public void setItemCount(long itemCount) throws IOException {
 super.setItemCount(itemCount);
 out.setItemCount(itemCount);
}

代码示例来源:origin: apache/avro

private void writeObjectArray(Schema element, Object[] data, Encoder out) throws IOException {
 int size = data.length;
 out.setItemCount(size);
 for (int i = 0; i < size; i++) {
  this.write(element, data[i], out);
 }
}

代码示例来源:origin: apache/avro

@Override
public void setItemCount(long itemCount) throws IOException { e.setItemCount(itemCount); }
@Override

代码示例来源:origin: apache/avro

static void writeArray(int[] data, Encoder out) throws IOException {
 int size = data.length;
 out.setItemCount(size);
 for (int i = 0; i < size; i++) {
  out.startItem();
  out.writeInt(data[i]);
 }
}

代码示例来源:origin: apache/avro

static void writeArray(long[] data, Encoder out) throws IOException {
 int size = data.length;
 out.setItemCount(size);
 for (int i = 0; i < size; i++) {
  out.startItem();
  out.writeLong(data[i]);
 }
}

代码示例来源:origin: apache/avro

static void writeArray(float[] data, Encoder out) throws IOException {
 int size = data.length;
 out.setItemCount(size);
 for (int i = 0; i < size; i++) {
  out.startItem();
  out.writeFloat(data[i]);
 }
}

代码示例来源:origin: org.apache.avro/avro

static void writeArray(float[] data, Encoder out) throws IOException {
 int size = data.length;
 out.setItemCount(size);
 for (int i = 0; i < size; i++) {
  out.startItem();
  out.writeFloat(data[i]);
 }
}

代码示例来源:origin: apache/avro

static void writeArray(boolean[] data, Encoder out) throws IOException {
 int size = data.length;
 out.setItemCount(size);
 for (int i = 0; i < size; i++) {
  out.startItem();
  out.writeBoolean(data[i]);
 }
}

代码示例来源:origin: apache/avro

static void writeArray(short[] data, Encoder out) throws IOException {
 int size = data.length;
 out.setItemCount(size);
 for (int i = 0; i < size; i++) {
  out.startItem();
  out.writeInt(data[i]);
 }
}

代码示例来源:origin: org.apache.avro/avro

static void writeArray(short[] data, Encoder out) throws IOException {
 int size = data.length;
 out.setItemCount(size);
 for (int i = 0; i < size; i++) {
  out.startItem();
  out.writeInt(data[i]);
 }
}

代码示例来源:origin: org.apache.avro/avro

static void writeArray(int[] data, Encoder out) throws IOException {
 int size = data.length;
 out.setItemCount(size);
 for (int i = 0; i < size; i++) {
  out.startItem();
  out.writeInt(data[i]);
 }
}

代码示例来源:origin: org.apache.avro/avro

static void writeArray(long[] data, Encoder out) throws IOException {
 int size = data.length;
 out.setItemCount(size);
 for (int i = 0; i < size; i++) {
  out.startItem();
  out.writeLong(data[i]);
 }
}

代码示例来源:origin: apache/avro

static void writeArray(char[] data, Encoder out) throws IOException {
 int size = data.length;
 out.setItemCount(size);
 for (int i = 0; i < size; i++) {
  out.startItem();
  out.writeInt(data[i]);
 }
}

代码示例来源:origin: apache/avro

static void writeArray(double[] data, Encoder out) throws IOException {
 int size = data.length;
 out.setItemCount(size);
 for (int i = 0; i < size; i++) {
  out.startItem();
  out.writeDouble(data[i]);
 }
}

代码示例来源:origin: org.apache.avro/avro

static void writeArray(boolean[] data, Encoder out) throws IOException {
 int size = data.length;
 out.setItemCount(size);
 for (int i = 0; i < size; i++) {
  out.startItem();
  out.writeBoolean(data[i]);
 }
}

代码示例来源:origin: org.apache.avro/avro

static void writeArray(char[] data, Encoder out) throws IOException {
 int size = data.length;
 out.setItemCount(size);
 for (int i = 0; i < size; i++) {
  out.startItem();
  out.writeInt(data[i]);
 }
}

代码示例来源:origin: org.apache.avro/avro

static void writeArray(double[] data, Encoder out) throws IOException {
 int size = data.length;
 out.setItemCount(size);
 for (int i = 0; i < size; i++) {
  out.startItem();
  out.writeDouble(data[i]);
 }
}

代码示例来源:origin: apache/avro

@Override protected void customEncode(org.apache.avro.io.Encoder out)
 throws java.io.IOException
{
 out.writeString(this.label);
 long size0 = this.children.size();
 out.writeArrayStart();
 out.setItemCount(size0);
 long actualSize0 = 0;
 for (org.apache.avro.Node e0: this.children) {
  actualSize0++;
  out.startItem();
  e0.customEncode(out);
 }
 out.writeArrayEnd();
 if (actualSize0 != size0)
  throw new java.util.ConcurrentModificationException("Array-size written was " + size0 + ", but element count was " + actualSize0 + ".");
}

相关文章