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

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

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

Encoder.writeNull介绍

[英]"Writes" a null value. (Doesn't actually write anything, but advances the state of the parser if this class is stateful.)
[中]“写入”空值。(实际上不写任何东西,但如果该类是有状态的,则会提升解析器的状态。)

代码示例

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

@Override
public void writeNull() throws IOException {
 parser.advance(Symbol.NULL);
 out.writeNull();
}

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

@Override
public void writeNull() throws IOException {
 parser.advance(Symbol.NULL);
 out.writeNull();
}

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

@Override
public void writeNull() throws IOException { e.writeNull(); }
@Override

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

out.writeNull();
} else {
 out.writeIndex(1);
 out.writeNull();
} else {
 out.writeIndex(1);
 out.writeNull();
} else {
 out.writeIndex(1);

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

out.writeNull();
} else {
 out.writeIndex(1);
 out.writeNull();
} else {
 out.writeIndex(1);

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

@Override protected void customEncode(org.apache.avro.io.Encoder out)
 throws java.io.IOException
{
 out.writeString(this.name);
 if (this.value == null) {
  out.writeIndex(0);
  out.writeNull();
 } else {
  out.writeIndex(1);
  out.writeString(this.value);
 }
}

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

@Override protected void customEncode(org.apache.avro.io.Encoder out)
 throws java.io.IOException
{
 if (this.id == null) {
  out.writeIndex(0);
  out.writeNull();
 } else {
  out.writeIndex(1);
  out.writeString(this.id);
 }
 out.writeString(this.useragent);
}

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

@Override protected void customEncode(org.apache.avro.io.Encoder out)
 throws java.io.IOException
{
 if (this.this$ == null) {
  out.writeIndex(0);
  out.writeNull();
 } else {
  out.writeIndex(1);
  out.writeString(this.this$);
 }
 out.writeString(this.String);
}

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

@Override protected void customEncode(org.apache.avro.io.Encoder out)
 throws java.io.IOException
{
 if (this.kind == null) {
  out.writeIndex(0);
  out.writeNull();
 } else {
  out.writeIndex(1);
  out.writeEnum(this.kind.ordinal());
 }
 if (this.value == null) {
  out.writeIndex(0);
  out.writeNull();
 } else {
  out.writeIndex(1);
  out.writeString(this.value);
 }
}

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

/** Called to write data.*/
protected void writeWithoutConversion(Schema schema, Object datum, Encoder out)
 throws IOException {
 try {
  switch (schema.getType()) {
  case RECORD: writeRecord(schema, datum, out); break;
  case ENUM:   writeEnum(schema, datum, out);   break;
  case ARRAY:  writeArray(schema, datum, out);  break;
  case MAP:    writeMap(schema, datum, out);    break;
  case UNION:
   int index = resolveUnion(schema, datum);
   out.writeIndex(index);
   write(schema.getTypes().get(index), datum, out);
   break;
  case FIXED:   writeFixed(schema, datum, out);   break;
  case STRING:  writeString(schema, datum, out);  break;
  case BYTES:   writeBytes(datum, out);           break;
  case INT:     out.writeInt(((Number)datum).intValue()); break;
  case LONG:    out.writeLong((Long)datum);       break;
  case FLOAT:   out.writeFloat((Float)datum);     break;
  case DOUBLE:  out.writeDouble((Double)datum);   break;
  case BOOLEAN: out.writeBoolean((Boolean)datum); break;
  case NULL:    out.writeNull();                  break;
  default: error(schema,datum);
  }
 } catch (NullPointerException e) {
  throw npe(e, " of "+schema.getFullName());
 }
}

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

/** Called to write data.*/
protected void writeWithoutConversion(Schema schema, Object datum, Encoder out)
 throws IOException {
 try {
  switch (schema.getType()) {
  case RECORD: writeRecord(schema, datum, out); break;
  case ENUM:   writeEnum(schema, datum, out);   break;
  case ARRAY:  writeArray(schema, datum, out);  break;
  case MAP:    writeMap(schema, datum, out);    break;
  case UNION:
   int index = resolveUnion(schema, datum);
   out.writeIndex(index);
   write(schema.getTypes().get(index), datum, out);
   break;
  case FIXED:   writeFixed(schema, datum, out);   break;
  case STRING:  writeString(schema, datum, out);  break;
  case BYTES:   writeBytes(datum, out);           break;
  case INT:     out.writeInt(((Number)datum).intValue()); break;
  case LONG:    out.writeLong((Long)datum);       break;
  case FLOAT:   out.writeFloat((Float)datum);     break;
  case DOUBLE:  out.writeDouble((Double)datum);   break;
  case BOOLEAN: out.writeBoolean((Boolean)datum); break;
  case NULL:    out.writeNull();                  break;
  default: error(schema,datum);
  }
 } catch (NullPointerException e) {
  throw npe(e, " of "+schema.getFullName());
 }
}

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

@Override protected void customEncode(org.apache.avro.io.Encoder out)
 throws java.io.IOException
{
 if (this.kind == null) {
  out.writeIndex(0);
  out.writeNull();
 } else {
  out.writeIndex(1);
  out.writeEnum(this.kind.ordinal());
 }
 if (this.value == null) {
  out.writeIndex(0);
  out.writeNull();
 } else {
  out.writeIndex(1);
  out.writeString(this.value);
 }
}

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

@Override protected void customEncode(org.apache.avro.io.Encoder out)
 throws java.io.IOException
{
 out.writeLong(this.timestamp);
 if (this.connection == null) {
  out.writeIndex(0);
  out.writeNull();
 } else {
  out.writeIndex(1);
  this.connection.customEncode(out);
 }
 this.httpRequest.customEncode(out);
}

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

case VALUE_NULL:
 out.writeIndex(JsonType.NULL.ordinal());
 out.writeNull();
 break;
case START_ARRAY:

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

out.writeNull();
} else {
 out.writeIndex(1);
 out.writeNull();
} else {
 out.writeIndex(1);
 out.writeNull();
} else {
 out.writeIndex(1);
 out.writeNull();
} else {
 out.writeIndex(1);
 out.writeNull();
} else {
 out.writeIndex(1);
 out.writeNull();
} else {
 out.writeIndex(1);
 out.writeNull();
} else {
 out.writeIndex(1);

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

out.writeNull();
} else {
 out.writeIndex(1);

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

out.writeNull();
} else {
 out.writeIndex(1);

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

case VALUE_NULL:
 out.writeIndex(JsonType.NULL.ordinal());
 out.writeNull();
 break;
case START_ARRAY:

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

public static void generateData(Encoder e, boolean useReadOnlyByteBuffer) throws IOException {
 e.writeNull();
 e.writeBoolean(true);
 e.writeBoolean(false);

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

switch (c) {
case 'N':
 vw.writeNull();
 break;
case 'B':

相关文章