本文整理了Java中org.apache.avro.io.Encoder.writeBoolean()
方法的一些代码示例,展示了Encoder.writeBoolean()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Encoder.writeBoolean()
方法的具体详情如下:
包路径:org.apache.avro.io.Encoder
类名称:Encoder
方法名:writeBoolean
[英]Write a boolean value.
[中]
代码示例来源:origin: apache/avro
@Override
protected void write(Object object, Encoder out) throws IOException {
out.writeBoolean(UNSAFE.getBoolean(object, offset));
}
}
代码示例来源:origin: apache/avro
@Override
void writeInternal(Encoder e) throws IOException {
for (int i = 0; i < sourceData.length;i+=4) {
e.writeBoolean(sourceData[i]);
e.writeBoolean(sourceData[i+1]);
e.writeBoolean(sourceData[i+2]);
e.writeBoolean(sourceData[i+3]);
}
}
代码示例来源:origin: apache/avro
@Override
public void writeBoolean(boolean b) throws IOException {
parser.advance(Symbol.BOOLEAN);
out.writeBoolean(b);
}
代码示例来源:origin: org.apache.avro/avro
@Override
public void writeBoolean(boolean b) throws IOException {
parser.advance(Symbol.BOOLEAN);
out.writeBoolean(b);
}
代码示例来源:origin: apache/avro
@Override
public void writeBoolean(boolean b) throws IOException { e.writeBoolean(b); }
@Override
代码示例来源:origin: org.apache.avro/avro
@Override
protected void write(Object object, Encoder out) throws IOException {
out.writeBoolean(UNSAFE.getBoolean(object, offset));
}
}
代码示例来源: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: 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
/** 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
if (!n.isBoolean())
throw new AvroTypeException("Non-boolean default for boolean: "+n);
e.writeBoolean(n.booleanValue());
break;
case NULL:
代码示例来源:origin: apache/avro
case VALUE_TRUE:
out.writeIndex(JsonType.BOOLEAN.ordinal());
out.writeBoolean(true);
break;
case VALUE_FALSE:
out.writeIndex(JsonType.BOOLEAN.ordinal());
out.writeBoolean(false);
break;
case VALUE_NULL:
代码示例来源:origin: org.apache.avro/avro
case VALUE_TRUE:
out.writeIndex(JsonType.BOOLEAN.ordinal());
out.writeBoolean(true);
break;
case VALUE_FALSE:
out.writeIndex(JsonType.BOOLEAN.ordinal());
out.writeBoolean(false);
break;
case VALUE_NULL:
代码示例来源:origin: org.apache.avro/avro
if (!n.isBoolean())
throw new AvroTypeException("Non-boolean default for boolean: "+n);
e.writeBoolean(n.getBooleanValue());
break;
case NULL:
代码示例来源:origin: apache/avro
e.writeBoolean(true);
e.writeBoolean(false);
byte[] bytes = new byte[10];
ByteBuffer bb;
代码示例来源:origin: apache/avro
case 'B':
boolean b = (Boolean) values[p++];
vw.writeBoolean(b);
break;
case 'I':
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.avro
@Override
protected void write(Object object, Encoder out) throws IOException {
out.writeBoolean(UNSAFE.getBoolean(object, offset));
}
}
代码示例来源:origin: org.apache.cassandra.deps/avro
@Override
public void writeBoolean(boolean b) throws IOException {
parser.advance(Symbol.BOOLEAN);
out.writeBoolean(b);
}
代码示例来源:origin: org.apache.hadoop/avro
@Override
public void writeBoolean(boolean b) throws IOException {
parser.advance(Symbol.BOOLEAN);
out.writeBoolean(b);
}
代码示例来源:origin: com.facebook.presto.hive/hive-apache
@Override
protected void write(Object object, Encoder out) throws IOException {
out.writeBoolean(UNSAFE.getBoolean(object, offset));
}
}
内容来源于网络,如有侵权,请联系作者删除!