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

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

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

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);
 }
}

相关文章