com.esotericsoftware.kryo.io.Output.writeBytes()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(5.4k)|赞(0)|评价(0)|浏览(145)

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

Output.writeBytes介绍

[英]Writes the bytes. Note the byte[] length is not written.
[中]写入字节。请注意,字节[]长度未写入。

代码示例

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

@Override
public void write(Kryo kryo, Output output, Object object) {
  ByteArrayOutputStream bos = new ByteArrayOutputStream();
  try {
    ObjectOutputStream oos = new ObjectOutputStream(bos);
    oos.writeObject(object);
    oos.flush();
  } catch (IOException e) {
    throw new RuntimeException(e);
  }
  byte[] ser = bos.toByteArray();
  output.writeInt(ser.length);
  output.writeBytes(ser);
}

代码示例来源:origin: alibaba/jstorm

@Override
public void write(Kryo kryo, Output output, Object object) {
  ByteArrayOutputStream bos = new ByteArrayOutputStream();
  try {
    ObjectOutputStream oos = new ObjectOutputStream(bos);
    oos.writeObject(object);
    oos.flush();
  } catch (IOException e) {
    throw new RuntimeException(e);
  }
  byte[] ser = bos.toByteArray();
  output.writeInt(ser.length);
  output.writeBytes(ser);
}

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

@Override
public void write(Kryo kryo, Output output, PyLong object) {
  byte[] data = object.getValue().toByteArray();
  output.writeShort(data.length);
  output.writeBytes(data);
}

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

private void writeValue(Output output, BytesWritable bytesWritable) {
 int size = bytesWritable.getLength();
 output.writeInt(size);
 output.writeBytes(bytesWritable.getBytes(), 0, size);
}

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

private void writeValue(Output output, BytesWritable bytesWritable) {
 int size = bytesWritable.getLength();
 output.writeInt(size);
 output.writeBytes(bytesWritable.getBytes(), 0, size);
}

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

private void writeHiveKey(Output output, HiveKey hiveKey) {
 int size = hiveKey.getLength();
 output.writeInt(size);
 output.writeBytes(hiveKey.getBytes(), 0, size);
 output.writeInt(0); // Since hashCode is not used, just put an arbitrary number
 output.writeInt(hiveKey.getDistKeyLength());
}

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

private void writeHiveKey(Output output, HiveKey hiveKey) {
 int size = hiveKey.getLength();
 output.writeInt(size);
 output.writeBytes(hiveKey.getBytes(), 0, size);
 output.writeInt(hiveKey.hashCode());
 output.writeInt(hiveKey.getDistKeyLength());
}

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

@Override
public void writeBytes(final byte[] array, final int offset, final int count) {
  unshadedOutput.writeBytes(array, offset, count);
}

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

@Override
public void write(Kryo kryo, Output output) {
 int numVariableMappings = variableMappings.isEmpty()?0:variableMappings.size();
 output.writeShort(numVariableMappings);
 for(Map m : variableMappings) {
  byte[] b = m == null?new byte[]{}:SerDeUtils.toBytes(m);
  output.writeInt(b.length);
  if(b.length > 0) {
   output.writeBytes(b);
  }
 }
}

代码示例来源:origin: com.esotericsoftware/kryo

/** Writes the bytes. Note the byte[] length is not written. */
public void write (byte[] bytes, int offset, int length) throws KryoException {
  writeBytes(bytes, offset, length);
}

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

@Override
public void write(Kryo kryo, Output output) {
 //storing tdigest
 ByteBuffer outBuffer = ByteBuffer.allocate(digest.byteSize());
 digest.asBytes(outBuffer);
 byte[] tdigestSerialized = outBuffer.array();
 output.writeInt(tdigestSerialized.length);
 output.writeBytes(tdigestSerialized);
 output.writeLong(n);
 output.writeDouble(sum);
 output.writeDouble(sumOfSquares);
 output.writeDouble(sumOfLogs);
 output.writeDouble(getMin());
 output.writeDouble(getMax());
 output.writeDouble(M1);
 output.writeDouble(M2);
 output.writeDouble(M3);
 output.writeDouble(M4);
}

代码示例来源:origin: com.esotericsoftware.kryo/kryo

/** Writes the bytes. Note the byte[] length is not written. */
public void writeBytes (byte[] bytes) throws KryoException {
  if (bytes == null) throw new IllegalArgumentException("bytes cannot be null.");
  writeBytes(bytes, 0, bytes.length);
}

代码示例来源:origin: com.esotericsoftware.kryo/kryo

/** Writes the bytes. Note the byte[] length is not written. */
public void write (byte[] bytes) throws KryoException {
  if (bytes == null) throw new IllegalArgumentException("bytes cannot be null.");
  writeBytes(bytes, 0, bytes.length);
}

代码示例来源:origin: com.esotericsoftware/kryo-shaded

/** Writes the bytes. Note the byte[] length is not written. */
public void write (byte[] bytes) throws KryoException {
  if (bytes == null) throw new IllegalArgumentException("bytes cannot be null.");
  writeBytes(bytes, 0, bytes.length);
}

代码示例来源:origin: cdapio/cdap

@Override
public Encoder writeBytes(byte[] bytes, int off, int len) throws IOException {
 output.writeInt(len);
 output.writeBytes(bytes, off, len);
 return this;
}

代码示例来源:origin: caskdata/cdap

@Override
public Encoder writeBytes(byte[] bytes, int off, int len) throws IOException {
 output.writeInt(len);
 output.writeBytes(bytes, off, len);
 return this;
}

代码示例来源:origin: com.esotericsoftware/kryo

public void write (Kryo kryo, Output output, byte[] object) {
  if (object == null) {
    output.writeVarInt(NULL, true);
    return;
  }
  output.writeVarInt(object.length + 1, true);
  output.writeBytes(object);
}

代码示例来源:origin: com.esotericsoftware.kryo/kryo

public void write (Kryo kryo, Output output, byte[] object) {
  if (object == null) {
    output.writeVarInt(NULL, true);
    return;
  }
  output.writeVarInt(object.length + 1, true);
  output.writeBytes(object);
}

代码示例来源:origin: com.twitter/chill-protobuf

@Override
public void write(Kryo kryo, Output output, Message mes) {
 byte[] ser = mes.toByteArray();
 output.writeInt(ser.length, true);
 output.writeBytes(ser);
}

代码示例来源:origin: org.onosproject/onos-core-serializers

@Override
public void write(Kryo kryo, Output output,
    IpPrefix object) {
  byte[] octs = object.address().toOctets();
  output.writeInt(octs.length);
  output.writeBytes(octs);
  output.writeInt(object.prefixLength());
}

相关文章