本文整理了Java中org.apache.avro.io.Encoder.writeFixed()
方法的一些代码示例,展示了Encoder.writeFixed()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Encoder.writeFixed()
方法的具体详情如下:
包路径:org.apache.avro.io.Encoder
类名称:Encoder
方法名:writeFixed
[英]Writes a fixed from a ByteBuffer.
[中]从ByteBuffer写入固定值。
代码示例来源:origin: apache/avro
/**
* A shorthand for <tt>writeFixed(bytes, 0, bytes.length)</tt>
* @param bytes
*/
public void writeFixed(byte[] bytes) throws IOException {
writeFixed(bytes, 0, bytes.length);
}
代码示例来源:origin: org.apache.avro/avro
/**
* A shorthand for <tt>writeFixed(bytes, 0, bytes.length)</tt>
* @param bytes
*/
public void writeFixed(byte[] bytes) throws IOException {
writeFixed(bytes, 0, bytes.length);
}
代码示例来源:origin: apache/avro
/** Writes a fixed from a ByteBuffer. */
public void writeFixed(ByteBuffer bytes) throws IOException {
int pos = bytes.position();
int len = bytes.limit() - pos;
if (bytes.hasArray()) {
writeFixed(bytes.array(), bytes.arrayOffset() + pos, len);
} else {
byte[] b = new byte[len];
bytes.duplicate().get(b, 0, len);
writeFixed(b, 0, len);
}
}
代码示例来源:origin: org.apache.avro/avro
/** Writes a fixed from a ByteBuffer. */
public void writeFixed(ByteBuffer bytes) throws IOException {
int pos = bytes.position();
int len = bytes.limit() - pos;
if (bytes.hasArray()) {
writeFixed(bytes.array(), bytes.arrayOffset() + pos, len);
} else {
byte[] b = new byte[len];
bytes.duplicate().get(b, 0, len);
writeFixed(b, 0, len);
}
}
代码示例来源:origin: apache/avro
@Override
public void writeFixed(byte[] bytes, int start, int len) throws IOException { e.writeFixed(bytes, start, len); }
@Override
代码示例来源:origin: apache/avro
/** Called to write a fixed value. May be overridden for alternate fixed
* representations.*/
protected void writeFixed(Schema schema, Object datum, Encoder out)
throws IOException {
out.writeFixed(((GenericFixed)datum).bytes(), 0, schema.getFixedSize());
}
代码示例来源:origin: org.apache.avro/avro
/** Called to write a fixed value. May be overridden for alternate fixed
* representations.*/
protected void writeFixed(Schema schema, Object datum, Encoder out)
throws IOException {
out.writeFixed(((GenericFixed)datum).bytes(), 0, schema.getFixedSize());
}
代码示例来源:origin: org.apache.avro/avro
@Override
public void writeFixed(byte[] bytes, int start, int len) throws IOException {
parser.advance(Symbol.FIXED);
Symbol.IntCheckAction top = (Symbol.IntCheckAction) parser.popSymbol();
if (len != top.size) {
throw new AvroTypeException(
"Incorrect length for fixed binary: expected " +
top.size + " but received " + len + " bytes.");
}
out.writeFixed(bytes, start, len);
}
代码示例来源:origin: apache/avro
@Override
public void writeFixed(byte[] bytes, int start, int len) throws IOException {
parser.advance(Symbol.FIXED);
Symbol.IntCheckAction top = (Symbol.IntCheckAction) parser.popSymbol();
if (len != top.size) {
throw new AvroTypeException(
"Incorrect length for fixed binary: expected " +
top.size + " but received " + len + " bytes.");
}
out.writeFixed(bytes, start, len);
}
代码示例来源:origin: apache/avro
@Override protected void customEncode(org.apache.avro.io.Encoder out)
throws java.io.IOException
{
out.writeFixed(this.hash.bytes(), 0, 16);
}
代码示例来源:origin: apache/avro
@Override protected void customEncode(org.apache.avro.io.Encoder out)
throws java.io.IOException
{
out.writeFixed(this.hash.bytes(), 0, 16);
}
代码示例来源:origin: apache/avro
@Override protected void customEncode(org.apache.avro.io.Encoder out)
throws java.io.IOException
out.writeFixed(this.clientHash.bytes(), 0, 16);
out.writeFixed(this.serverHash.bytes(), 0, 16);
代码示例来源:origin: apache/avro
@Override protected void customEncode(org.apache.avro.io.Encoder out)
throws java.io.IOException
{
out.writeString(this.name);
out.writeEnum(this.kind.ordinal());
out.writeFixed(this.hash.bytes(), 0, 16);
}
代码示例来源:origin: apache/avro
@Override protected void customEncode(org.apache.avro.io.Encoder out)
throws java.io.IOException
{
out.writeString(this.name);
out.writeEnum(this.kind.ordinal());
out.writeFixed(this.hash.bytes(), 0, 16);
}
代码示例来源:origin: apache/avro
} else {
out.writeIndex(1);
out.writeFixed(this.serverHash.bytes(), 0, 16);
代码示例来源:origin: apache/avro
bb = Arrays.copyOf(bb, s.getFixedSize());
e.writeFixed(bb);
break;
case STRING:
代码示例来源:origin: org.apache.avro/avro
bb = Arrays.copyOf(bb, s.getFixedSize());
e.writeFixed(bb);
break;
case STRING:
代码示例来源:origin: apache/avro
e.writeDouble(Double.NEGATIVE_INFINITY);
e.writeEnum(65);
e.writeFixed(bytes);
e.writeFixed(bytes, 7, 2);
e.writeFloat(1.0f);
e.writeFloat(r.nextFloat());
代码示例来源:origin: apache/avro
vw.writeFixed(bb);
break;
代码示例来源:origin: Netflix/iceberg
@Override
public void write(byte[] bytes, Encoder encoder) throws IOException {
Preconditions.checkArgument(bytes.length == length,
"Cannot write byte array of length %s as fixed[%s]", bytes.length, length);
encoder.writeFixed(bytes);
}
}
内容来源于网络,如有侵权,请联系作者删除!