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

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

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

ObjectOutputStream.resetState介绍

[英]Reset the receiver. The collection of objects already dumped by the receiver is reset, and internal structures are also reset so that the receiver knows it is in a fresh clean state.
[中]重置接收器。接收器已经转储的对象集合被重置,内部结构也被重置,以便接收器知道它处于全新的干净状态。

代码示例

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

/**
 * Resets the state of this stream. A marker is written to the stream, so
 * that the corresponding input stream will also perform a reset at the same
 * point. Objects previously written are no longer remembered, so they will
 * be written again (instead of a cyclical reference) if found in the object
 * graph.
 *
 * @throws IOException
 *             if {@code reset()} is called during the serialization of an
 *             object.
 */
public void reset() throws IOException {
  // First we flush what we have
  drain();
  /*
   * And dump a reset marker, so that the ObjectInputStream can reset
   * itself at the same point
   */
  output.writeByte(TC_RESET);
  // Now we reset ourselves
  resetState();
}

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

/**
 * Constructs a new ObjectOutputStream that writes to the OutputStream
 * {@code output}.
 *
 * @param output
 *            the non-null OutputStream to filter writes on.
 *
 * @throws IOException
 *             if an error occurs while writing the object stream
 *             header
 */
public ObjectOutputStream(OutputStream output) throws IOException {
  this.output = (output instanceof DataOutputStream) ? (DataOutputStream) output
      : new DataOutputStream(output);
  this.enableReplace = false;
  this.protocolVersion = PROTOCOL_VERSION_2;
  this.subclassOverridingImplementation = false;
  resetState();
  this.nestedException = new StreamCorruptedException();
  // So write...() methods can be used by
  // subclasses during writeStreamHeader()
  primitiveTypes = this.output;
  // Has to be done here according to the specification
  writeStreamHeader();
  primitiveTypes = null;
}

代码示例来源:origin: ibinti/bugvm

/**
 * Resets the state of this stream. A marker is written to the stream, so
 * that the corresponding input stream will also perform a reset at the same
 * point. Objects previously written are no longer remembered, so they will
 * be written again (instead of a cyclical reference) if found in the object
 * graph.
 *
 * @throws IOException
 *             if {@code reset()} is called during the serialization of an
 *             object.
 */
public void reset() throws IOException {
  // First we flush what we have
  drain();
  /*
   * And dump a reset marker, so that the ObjectInputStream can reset
   * itself at the same point
   */
  output.writeByte(TC_RESET);
  // Now we reset ourselves
  resetState();
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

/**
 * Resets the state of this stream. A marker is written to the stream, so
 * that the corresponding input stream will also perform a reset at the same
 * point. Objects previously written are no longer remembered, so they will
 * be written again (instead of a cyclical reference) if found in the object
 * graph.
 *
 * @throws IOException
 *             if {@code reset()} is called during the serialization of an
 *             object.
 */
public void reset() throws IOException {
  // First we flush what we have
  drain();
  /*
   * And dump a reset marker, so that the ObjectInputStream can reset
   * itself at the same point
   */
  output.writeByte(TC_RESET);
  // Now we reset ourselves
  resetState();
}

代码示例来源:origin: MobiVM/robovm

/**
 * Resets the state of this stream. A marker is written to the stream, so
 * that the corresponding input stream will also perform a reset at the same
 * point. Objects previously written are no longer remembered, so they will
 * be written again (instead of a cyclical reference) if found in the object
 * graph.
 *
 * @throws IOException
 *             if {@code reset()} is called during the serialization of an
 *             object.
 */
public void reset() throws IOException {
  // First we flush what we have
  drain();
  /*
   * And dump a reset marker, so that the ObjectInputStream can reset
   * itself at the same point
   */
  output.writeByte(TC_RESET);
  // Now we reset ourselves
  resetState();
}

代码示例来源:origin: com.bugvm/bugvm-rt

/**
 * Resets the state of this stream. A marker is written to the stream, so
 * that the corresponding input stream will also perform a reset at the same
 * point. Objects previously written are no longer remembered, so they will
 * be written again (instead of a cyclical reference) if found in the object
 * graph.
 *
 * @throws IOException
 *             if {@code reset()} is called during the serialization of an
 *             object.
 */
public void reset() throws IOException {
  // First we flush what we have
  drain();
  /*
   * And dump a reset marker, so that the ObjectInputStream can reset
   * itself at the same point
   */
  output.writeByte(TC_RESET);
  // Now we reset ourselves
  resetState();
}

代码示例来源:origin: com.gluonhq/robovm-rt

/**
 * Resets the state of this stream. A marker is written to the stream, so
 * that the corresponding input stream will also perform a reset at the same
 * point. Objects previously written are no longer remembered, so they will
 * be written again (instead of a cyclical reference) if found in the object
 * graph.
 *
 * @throws IOException
 *             if {@code reset()} is called during the serialization of an
 *             object.
 */
public void reset() throws IOException {
  // First we flush what we have
  drain();
  /*
   * And dump a reset marker, so that the ObjectInputStream can reset
   * itself at the same point
   */
  output.writeByte(TC_RESET);
  // Now we reset ourselves
  resetState();
}

代码示例来源:origin: MobiVM/robovm

/**
 * Constructs a new ObjectOutputStream that writes to the OutputStream
 * {@code output}.
 *
 * @param output
 *            the non-null OutputStream to filter writes on.
 *
 * @throws IOException
 *             if an error occurs while writing the object stream
 *             header
 */
public ObjectOutputStream(OutputStream output) throws IOException {
  this.output = (output instanceof DataOutputStream) ? (DataOutputStream) output
      : new DataOutputStream(output);
  this.enableReplace = false;
  this.protocolVersion = PROTOCOL_VERSION_2;
  this.subclassOverridingImplementation = false;
  resetState();
  this.nestedException = new StreamCorruptedException();
  // So write...() methods can be used by
  // subclasses during writeStreamHeader()
  primitiveTypes = this.output;
  // Has to be done here according to the specification
  writeStreamHeader();
  primitiveTypes = null;
}

代码示例来源:origin: com.jtransc/jtransc-rt

/**
 * Resets the state of this stream. A marker is written to the stream, so
 * that the corresponding input stream will also perform a reset at the same
 * point. Objects previously written are no longer remembered, so they will
 * be written again (instead of a cyclical reference) if found in the object
 * graph.
 *
 * @throws IOException
 *             if {@code reset()} is called during the serialization of an
 *             object.
 */
public void reset() throws IOException {
  // First we flush what we have
  drain();
  /*
   * And dump a reset marker, so that the ObjectInputStream can reset
   * itself at the same point
   */
  output.writeByte(TC_RESET);
  // Now we reset ourselves
  resetState();
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

/**
 * Constructs a new ObjectOutputStream that writes to the OutputStream
 * {@code output}.
 *
 * @param output
 *            the non-null OutputStream to filter writes on.
 *
 * @throws IOException
 *             if an error occurs while writing the object stream
 *             header
 */
public ObjectOutputStream(OutputStream output) throws IOException {
  this.output = (output instanceof DataOutputStream) ? (DataOutputStream) output
      : new DataOutputStream(output);
  this.enableReplace = false;
  this.protocolVersion = PROTOCOL_VERSION_2;
  this.subclassOverridingImplementation = false;
  resetState();
  this.nestedException = new StreamCorruptedException();
  // So write...() methods can be used by
  // subclasses during writeStreamHeader()
  primitiveTypes = this.output;
  // Has to be done here according to the specification
  writeStreamHeader();
  primitiveTypes = null;
}

代码示例来源:origin: ibinti/bugvm

/**
 * Constructs a new ObjectOutputStream that writes to the OutputStream
 * {@code output}.
 *
 * @param output
 *            the non-null OutputStream to filter writes on.
 *
 * @throws IOException
 *             if an error occurs while writing the object stream
 *             header
 */
public ObjectOutputStream(OutputStream output) throws IOException {
  this.output = (output instanceof DataOutputStream) ? (DataOutputStream) output
      : new DataOutputStream(output);
  this.enableReplace = false;
  this.protocolVersion = PROTOCOL_VERSION_2;
  this.subclassOverridingImplementation = false;
  resetState();
  this.nestedException = new StreamCorruptedException();
  // So write...() methods can be used by
  // subclasses during writeStreamHeader()
  primitiveTypes = this.output;
  // Has to be done here according to the specification
  writeStreamHeader();
  primitiveTypes = null;
}

代码示例来源:origin: com.gluonhq/robovm-rt

/**
 * Constructs a new ObjectOutputStream that writes to the OutputStream
 * {@code output}.
 *
 * @param output
 *            the non-null OutputStream to filter writes on.
 *
 * @throws IOException
 *             if an error occurs while writing the object stream
 *             header
 */
public ObjectOutputStream(OutputStream output) throws IOException {
  this.output = (output instanceof DataOutputStream) ? (DataOutputStream) output
      : new DataOutputStream(output);
  this.enableReplace = false;
  this.protocolVersion = PROTOCOL_VERSION_2;
  this.subclassOverridingImplementation = false;
  resetState();
  this.nestedException = new StreamCorruptedException();
  // So write...() methods can be used by
  // subclasses during writeStreamHeader()
  primitiveTypes = this.output;
  // Has to be done here according to the specification
  writeStreamHeader();
  primitiveTypes = null;
}

代码示例来源:origin: FlexoVM/flexovm

/**
 * Resets the state of this stream. A marker is written to the stream, so
 * that the corresponding input stream will also perform a reset at the same
 * point. Objects previously written are no longer remembered, so they will
 * be written again (instead of a cyclical reference) if found in the object
 * graph.
 *
 * @throws IOException
 *             if {@code reset()} is called during the serialization of an
 *             object.
 */
public void reset() throws IOException {
  // First we flush what we have
  drain();
  /*
   * And dump a reset marker, so that the ObjectInputStream can reset
   * itself at the same point
   */
  output.writeByte(TC_RESET);
  // Now we reset ourselves
  resetState();
}

代码示例来源:origin: com.jtransc/jtransc-rt

/**
 * Constructs a new ObjectOutputStream that writes to the OutputStream
 * {@code output}.
 *
 * @param output
 *            the non-null OutputStream to filter writes on.
 *
 * @throws IOException
 *             if an error occurs while writing the object stream
 *             header
 */
public ObjectOutputStream(OutputStream output) throws IOException {
  this.output = (output instanceof DataOutputStream) ? (DataOutputStream) output
      : new DataOutputStream(output);
  this.enableReplace = false;
  this.protocolVersion = PROTOCOL_VERSION_2;
  this.subclassOverridingImplementation = false;
  resetState();
  this.nestedException = new StreamCorruptedException();
  // So write...() methods can be used by
  // subclasses during writeStreamHeader()
  primitiveTypes = this.output;
  // Has to be done here according to the specification
  writeStreamHeader();
  primitiveTypes = null;
}

代码示例来源:origin: com.bugvm/bugvm-rt

/**
 * Constructs a new ObjectOutputStream that writes to the OutputStream
 * {@code output}.
 *
 * @param output
 *            the non-null OutputStream to filter writes on.
 *
 * @throws IOException
 *             if an error occurs while writing the object stream
 *             header
 */
public ObjectOutputStream(OutputStream output) throws IOException {
  this.output = (output instanceof DataOutputStream) ? (DataOutputStream) output
      : new DataOutputStream(output);
  this.enableReplace = false;
  this.protocolVersion = PROTOCOL_VERSION_2;
  this.subclassOverridingImplementation = false;
  resetState();
  this.nestedException = new StreamCorruptedException();
  // So write...() methods can be used by
  // subclasses during writeStreamHeader()
  primitiveTypes = this.output;
  // Has to be done here according to the specification
  writeStreamHeader();
  primitiveTypes = null;
}

代码示例来源:origin: FlexoVM/flexovm

/**
 * Constructs a new ObjectOutputStream that writes to the OutputStream
 * {@code output}.
 *
 * @param output
 *            the non-null OutputStream to filter writes on.
 *
 * @throws IOException
 *             if an error occurs while writing the object stream
 *             header
 */
public ObjectOutputStream(OutputStream output) throws IOException {
  this.output = (output instanceof DataOutputStream) ? (DataOutputStream) output
      : new DataOutputStream(output);
  this.enableReplace = false;
  this.protocolVersion = PROTOCOL_VERSION_2;
  this.subclassOverridingImplementation = false;
  resetState();
  this.nestedException = new StreamCorruptedException();
  // So write...() methods can be used by
  // subclasses during writeStreamHeader()
  primitiveTypes = this.output;
  // Has to be done here according to the specification
  writeStreamHeader();
  primitiveTypes = null;
}

相关文章

ObjectOutputStream类方法