java.io.ObjectOutputStream.write()方法的使用及代码示例

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

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

ObjectOutputStream.write介绍

[英]Writes a single byte to the target stream. Only the least significant byte of the integer value is written to the stream. Blocks until the byte is actually written.
[中]将单个字节写入目标流。只将整数值的最低有效字节写入流。直到字节被实际写入。

代码示例

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

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

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

/** {@inheritDoc} */
@Override public void write(byte[] b) throws IOException {
  oos.write(b);
}

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

private void writeObject(java.io.ObjectOutputStream out) throws IOException {
  out.defaultWriteObject();
  if (codec != null) {
    out.writeByte(codec.getCodecByte());
  } else {
    out.writeByte(-1);
  }
  if (userDefinedSchema != null) {
    byte[] json = userDefinedSchema.toString().getBytes(ConfigConstants.DEFAULT_CHARSET);
    out.writeInt(json.length);
    out.write(json);
  } else {
    out.writeInt(0);
  }
}

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

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

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

/** {@inheritDoc} */
@Override public void write(int b) throws IOException {
  oos.write(b);
}

代码示例来源:origin: prestodb/presto

private void writeObject(ObjectOutputStream out) throws IOException {
  out.writeInt(data.length);
  out.write(data);
 }
}

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

/** {@inheritDoc} */
@Override public void write(byte[] b) throws IOException {
  oos.write(b);
}

代码示例来源:origin: wildfly/wildfly

private int writeBytes(byte[] data, ObjectOutputStream oos) throws IOException {
  int len = data.length;
  oos.writeInt(len);
  oos.write(data, 0, len);
  return len;
}

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

/** {@inheritDoc} */
@Override public void write(int b) throws IOException {
  oos.write(b);
}

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

private void writeObject(ObjectOutputStream oos) throws IOException {
  oos.defaultWriteObject();
  byte[] ser = TridentUtils.thriftSerialize(thriftGrouping);
  oos.writeInt(ser.length);
  oos.write(ser);
}

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

/** {@inheritDoc} */
@Override public void write(byte[] b, int off, int len) throws IOException {
  oos.write(b, off, len);
}

代码示例来源:origin: wildfly/wildfly

private void writeObject(ObjectOutputStream out) throws IOException {
  out.defaultWriteObject();
  byte[] bytes = this.getBytes();
  if (bytes != null) {
    out.writeInt(bytes.length);
    out.write(bytes);
  } else {
    out.writeInt(0);
  }
}

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

/** {@inheritDoc} */
@Override public void write(byte[] b, int off, int len) throws IOException {
  oos.write(b, off, len);
}

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

private void writeObject(ObjectOutputStream oos) throws IOException {
  oos.defaultWriteObject();
  byte[] ser = TridentUtils.thriftSerialize(thriftGrouping);
  oos.writeInt(ser.length);
  oos.write(ser);
}

代码示例来源:origin: wildfly/wildfly

/** {@inheritDoc} */
public void write(final byte[] buf) throws IOException {
  oos.write(buf);
}

代码示例来源:origin: org.apache.hadoop/hadoop-common

private void writeObject(ObjectOutputStream out) throws IOException {
 out.defaultWriteObject();
 out.writeInt(fd.remaining());
 if (fd.hasArray()) {
  out.write(fd.array(), fd.position(), fd.remaining());
 } else {
  byte[] x = new byte[fd.remaining()];
  fd.slice().get(x);
  out.write(x);
 }
}

代码示例来源:origin: wildfly/wildfly

/** {@inheritDoc} */
public void write(final int val) throws IOException {
  oos.write(val);
}

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

/** {@inheritDoc} */
private void writeObject(ObjectOutputStream out) throws IOException {
  try {
    byte[] arr = marshal(str);
    out.writeInt(arr.length);
    out.write(arr);
    out.writeInt(val);
  }
  catch (IgniteCheckedException e) {
    throw new IOException(e);
  }
}

代码示例来源:origin: wildfly/wildfly

/** {@inheritDoc} */
public void write(final byte[] buf, final int off, final int len) throws IOException {
  oos.write(buf, off, len);
}

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

/** */
private void writeObject(ObjectOutputStream os) throws IOException{
  os.write(10);
}

相关文章

ObjectOutputStream类方法