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

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

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

Output.getOutputStream介绍

暂无

代码示例

代码示例来源:origin: pbailis/ramp-sigmod2014-code

public void serialize(Object object) throws IOException {
  kryo.writeClassAndObject(this.output, object);
  this.output.flush();
  this.output.getOutputStream().flush();
}

代码示例来源:origin: org.apache.apex/apex-engine

public void setOutputStream(@Nullable final OutputStream out) throws IOException
{
 final Output output;
 if (out != null) {
  output = new Output(4096, -1)
  {
   @Override
   public void flush() throws KryoException
   {
    super.flush();
    // Kryo does not flush internal output stream during flush. We need to flush it explicitly.
    try {
     getOutputStream().flush();
    } catch (IOException e) {
     throw new KryoException(e);
    }
   }
  };
  output.setOutputStream(out);
 } else {
  output = null;
 }
 final Output oldOut = this.output.getAndSet(output);
 if (oldOut != null && oldOut.getOutputStream() != out) {
  synchronized (oldOut) {
   oldOut.close();
  }
 }
}

相关文章