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

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

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

Output.write介绍

[英]Writes a byte.
[中]写入一个字节。

代码示例

代码示例来源:origin: apache/incubator-dubbo

@Override
public void writeBytes(byte[] v, int off, int len) throws IOException {
  if (v == null) {
    output.writeInt(-1);
  } else {
    output.writeInt(len);
    output.write(v, off, len);
  }
}

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

private void safeWriteToOutput(Output output,
                BaseProtocol.JobResult<?> jobResult) throws IOException {
 ByteArrayOutputStream boas = new ByteArrayOutputStream();
 ObjectOutputStream oos = new ObjectOutputStream(boas);
 oos.writeObject(jobResult);
 oos.flush();
 output.write(boas.toByteArray());
 output.flush();
}

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

public void write(Kryo kryo, Output output, BytesWritable object) {
 output.writeVarInt(object.getLength(), true);
 output.write(object.getBytes(), 0, object.getLength());
}

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

@Override
public void write(Kryo kryo, Output output, PercentileCounter counter) {
  int length = counter.getRegisters().byteSize();
  ByteBuffer buffer = ByteBuffer.allocate(length);
  counter.getRegisters().asSmallBytes(buffer);
  output.writeDouble(counter.getCompression());
  output.writeDouble(counter.getQuantileRatio());
  output.writeInt(buffer.position());
  output.write(buffer.array(), 0, buffer.position());
}

代码示例来源:origin: apache/incubator-dubbo

@Override
public void writeBytes(byte[] v, int off, int len) throws IOException {
  if (v == null) {
    output.writeInt(-1);
  } else {
    output.writeInt(len);
    output.write(v, off, len);
  }
}

代码示例来源:origin: davidmoten/rtree

private void writeValue(Output output, T t) {
  byte[] bytes = serializer.call(t);
  output.write(bytes.length);
  output.write(bytes);
}

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

public void write(Kryo kryo, Output output, HiveKey object) {
 output.writeVarInt(object.getLength(), true);
 output.write(object.getBytes(), 0, object.getLength());
 output.writeVarInt(object.hashCode(), false);
}

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

@Override
public void write(Kryo kryo, Output output, ByteBuffer object) {
  output.writeInt(object.array().length);
  output.write(object.array());
}

代码示例来源:origin: davidmoten/rtree

private void writeRectangle(Output output, S g) {
  Rectangle r = (Rectangle) g;
  output.write(0);
  writeBounds(output, r);
}

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

public void write(Kryo kryo, Output output, HiveKey object) {
 output.writeVarInt(object.getLength(), true);
 output.write(object.getBytes(), 0, object.getLength());
}

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

@Override
public void write(Kryo kryo, Output output, TupleImpl tuple) {
  byte[] bytes = tupleSerializer.serialize(tuple);
  output.writeInt(bytes.length);
  output.write(bytes);
}

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

public void writeChars (String s) throws IOException {
  int len = s.length();
  for (int i = 0; i < len; i++) {
    int v = s.charAt(i);
    output.write((v >>> 8) & 0xFF);
    output.write((v >>> 0) & 0xFF);
  }
}

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

public void write(Kryo kryo, Output output, PyObject po) {
  try {
    byte[] serPo = SerializationUtils.serializeObject(po);
    output.writeInt(serPo.length);
    output.write(serPo);
  } catch (IOException e) {
    throw new KryoException("Failed to serialize object.", e);
  }
}

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

public void writeChars (String s) throws IOException {
  int len = s.length();
  for (int i = 0; i < len; i++) {
     int v = s.charAt(i);
     output.write((v >>> 8) & 0xFF);
     output.write((v >>> 0) & 0xFF);
  }
}

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

@Override
public void write(Kryo kryo, Output output, TestRecord object) {
  output.writeInt(object.buffer.length);
  output.write(object.buffer);
}

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

public void writeBytes (String s) throws IOException {
  int len = s.length();
  for (int i = 0; i < len; i++) {
    output.write((byte)s.charAt(i));
  }
}

代码示例来源:origin: jobxhub/JobX

public void writeBytes(byte[] v, int off, int len) throws IOException {
  if (v == null) {
    output.writeInt(-1);
  } else {
    output.writeInt(len);
    output.write(v, off, len);
  }
}

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

public void writeBytes (String s) throws IOException {
  int len = s.length();
  for (int i = 0; i < len; i++) {
     output.write((byte)s.charAt(i));
  }
}

代码示例来源:origin: com.alibaba/dubbo

@Override
public void writeBytes(byte[] v, int off, int len) throws IOException {
  if (v == null) {
    output.writeInt(-1);
  } else {
    output.writeInt(len);
    output.write(v, off, len);
  }
}

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

public void writeBytes (String s) throws IOException {
  int len = s.length();
  for (int i = 0; i < len; i++) {
    output.write((byte)s.charAt(i));
  }
}

相关文章