java.io.ObjectInputStream.nextHandle()方法的使用及代码示例

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

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

ObjectInputStream.nextHandle介绍

[英]Return the next int handle to be used to indicate cyclic references being loaded from the stream.
[中]返回下一个int句柄,用于指示从流中加载的循环引用。

代码示例

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

/**
 * Read a string encoded in {@link DataInput modified UTF-8} from the
 * receiver. Return the string read.
 *
 * @param unshared
 *            read the object unshared
 * @return the string just read.
 * @throws IOException
 *             If an IO exception happened when reading the String.
 */
private Object readNewString(boolean unshared) throws IOException {
  Object result = input.readUTF();
  if (enableResolve) {
    result = resolveObject(result);
  }
  registerObjectRead(result, nextHandle(), unshared);
  return result;
}

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

/**
 * Read a new String in UTF format from the receiver. Return the string
 * read.
 *
 * @param unshared
 *            read the object unshared
 * @return the string just read.
 *
 * @throws IOException
 *             If an IO exception happened when reading the String.
 */
private Object readNewLongString(boolean unshared) throws IOException {
  long length = input.readLong();
  Object result = input.decodeUTF((int) length);
  if (enableResolve) {
    result = resolveObject(result);
  }
  registerObjectRead(result, nextHandle(), unshared);
  return result;
}

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

/**
 * Reads a class descriptor from the source stream.
 *
 * @return the class descriptor read from the source stream.
 * @throws ClassNotFoundException
 *             if a class for one of the objects cannot be found.
 * @throws IOException
 *             if an error occurs while reading from the source stream.
 */
protected ObjectStreamClass readClassDescriptor() throws IOException, ClassNotFoundException {
  ObjectStreamClass newClassDesc = new ObjectStreamClass();
  String name = input.readUTF();
  if (name.length() == 0) {
    throw new IOException("The stream is corrupted");
  }
  newClassDesc.setName(name);
  newClassDesc.setSerialVersionUID(input.readLong());
  newClassDesc.setFlags(input.readByte());
  /*
   * We must register the class descriptor before reading field
   * descriptors. If called outside of readObject, the descriptorHandle
   * might be unset.
   */
  if (descriptorHandle == -1) {
    descriptorHandle = nextHandle();
  }
  registerObjectRead(newClassDesc, descriptorHandle, false);
  readFieldDescriptors(newClassDesc);
  return newClassDesc;
}

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

int newHandle = nextHandle();

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

/**
 * Reads a new class from the receiver. It is assumed the class has not been
 * read yet (not a cyclic reference). Return the class read.
 *
 * @param unshared
 *            read the object unshared
 * @return The {@code java.lang.Class} read from the stream.
 *
 * @throws IOException
 *             If an IO exception happened when reading the class.
 * @throws ClassNotFoundException
 *             If a class for one of the objects could not be found
 */
private Class<?> readNewClass(boolean unshared) throws ClassNotFoundException, IOException {
  ObjectStreamClass classDesc = readClassDesc();
  if (classDesc == null) {
    throw missingClassDescriptor();
  }
  Class<?> localClass = classDesc.forClass();
  if (localClass != null) {
    registerObjectRead(localClass, nextHandle(), unshared);
  }
  return localClass;
}

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

int newHandle = nextHandle();

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

private ObjectStreamClass readEnumDescInternal() throws IOException, ClassNotFoundException {
  ObjectStreamClass classDesc;
  primitiveData = input;
  int oldHandle = descriptorHandle;
  descriptorHandle = nextHandle();
  classDesc = readClassDescriptor();
  registerObjectRead(classDesc, descriptorHandle, false);
  descriptorHandle = oldHandle;
  primitiveData = emptyStream;
  classDesc.setClass(resolveClass(classDesc));
  // Consume unread class annotation data and TC_ENDBLOCKDATA
  discardData();
  ObjectStreamClass superClass = readClassDesc();
  checkedSetSuperClassDesc(classDesc, superClass);
  // Check SUIDs, note all SUID for Enum is 0L
  if (0L != classDesc.getSerialVersionUID() || 0L != superClass.getSerialVersionUID()) {
    throw new InvalidClassException(superClass.getName(),
        "Incompatible class (SUID): " + superClass + " but expected " + superClass);
  }
  byte tc = nextTC();
  // discard TC_ENDBLOCKDATA after classDesc if any
  if (tc == TC_ENDBLOCKDATA) {
    // read next parent class. For enum, it may be null
    superClass.setSuperclass(readClassDesc());
  } else {
    // not TC_ENDBLOCKDATA, push back for next read
    pushbackTC();
  }
  return classDesc;
}

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

descriptorHandle = nextHandle();
ObjectStreamClass newClassDesc = readClassDescriptor();
registerObjectRead(newClassDesc, descriptorHandle, unshared);

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

ObjectStreamClass streamClass = ObjectStreamClass.lookup(proxyClass);
streamClass.setLoadFields(ObjectStreamClass.NO_FIELDS);
registerObjectRead(streamClass, nextHandle(), false);
checkedSetSuperClassDesc(streamClass, readClassDesc());
return streamClass;

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

int newHandle = nextHandle();
Class<?> objectClass = classDesc.forClass();
Object result = null;

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

/**
 * Read a string encoded in {@link DataInput modified UTF-8} from the
 * receiver. Return the string read.
 *
 * @param unshared
 *            read the object unshared
 * @return the string just read.
 * @throws IOException
 *             If an IO exception happened when reading the String.
 */
private Object readNewString(boolean unshared) throws IOException {
  Object result = input.readUTF();
  if (enableResolve) {
    result = resolveObject(result);
  }
  registerObjectRead(result, nextHandle(), unshared);
  return result;
}

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

/**
 * Read a string encoded in {@link DataInput modified UTF-8} from the
 * receiver. Return the string read.
 *
 * @param unshared
 *            read the object unshared
 * @return the string just read.
 * @throws IOException
 *             If an IO exception happened when reading the String.
 */
private Object readNewString(boolean unshared) throws IOException {
  Object result = input.readUTF();
  if (enableResolve) {
    result = resolveObject(result);
  }
  registerObjectRead(result, nextHandle(), unshared);
  return result;
}

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

/**
 * Read a string encoded in {@link DataInput modified UTF-8} from the
 * receiver. Return the string read.
 *
 * @param unshared read the object unshared
 * @return the string just read.
 * @throws IOException If an IO exception happened when reading the String.
 */
private Object readNewString(boolean unshared) throws IOException {
  Object result = input.readUTF();
  if (enableResolve) {
    result = resolveObject(result);
  }
  registerObjectRead(result, nextHandle(), unshared);
  return result;
}

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

/**
 * Read a string encoded in {@link DataInput modified UTF-8} from the
 * receiver. Return the string read.
 *
 * @param unshared
 *            read the object unshared
 * @return the string just read.
 * @throws IOException
 *             If an IO exception happened when reading the String.
 */
private Object readNewString(boolean unshared) throws IOException {
  Object result = input.readUTF();
  if (enableResolve) {
    result = resolveObject(result);
  }
  registerObjectRead(result, nextHandle(), unshared);
  return result;
}

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

/**
 * Read a string encoded in {@link DataInput modified UTF-8} from the
 * receiver. Return the string read.
 *
 * @param unshared
 *            read the object unshared
 * @return the string just read.
 * @throws IOException
 *             If an IO exception happened when reading the String.
 */
private Object readNewString(boolean unshared) throws IOException {
  Object result = input.readUTF();
  if (enableResolve) {
    result = resolveObject(result);
  }
  registerObjectRead(result, nextHandle(), unshared);
  return result;
}

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

/**
 * Read a string encoded in {@link DataInput modified UTF-8} from the
 * receiver. Return the string read.
 *
 * @param unshared
 *            read the object unshared
 * @return the string just read.
 * @throws IOException
 *             If an IO exception happened when reading the String.
 */
private Object readNewString(boolean unshared) throws IOException {
  Object result = input.readUTF();
  if (enableResolve) {
    result = resolveObject(result);
  }
  registerObjectRead(result, nextHandle(), unshared);
  return result;
}

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

/**
 * Read a string encoded in {@link DataInput modified UTF-8} from the
 * receiver. Return the string read.
 *
 * @param unshared
 *            read the object unshared
 * @return the string just read.
 * @throws IOException
 *             If an IO exception happened when reading the String.
 */
private Object readNewString(boolean unshared) throws IOException {
  Object result = input.readUTF();
  if (enableResolve) {
    result = resolveObject(result);
  }
  registerObjectRead(result, nextHandle(), unshared);
  return result;
}

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

/**
 * Read a new String in UTF format from the receiver. Return the string
 * read.
 *
 * @param unshared read the object unshared
 * @return the string just read.
 * @throws IOException If an IO exception happened when reading the String.
 */
private Object readNewLongString(boolean unshared) throws IOException {
  long length = input.readLong();
  Object result = input.decodeUTF((int) length);
  if (enableResolve) {
    result = resolveObject(result);
  }
  registerObjectRead(result, nextHandle(), unshared);
  return result;
}

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

/**
 * Read a new String in UTF format from the receiver. Return the string
 * read.
 *
 * @param unshared
 *            read the object unshared
 * @return the string just read.
 *
 * @throws IOException
 *             If an IO exception happened when reading the String.
 */
private Object readNewLongString(boolean unshared) throws IOException {
  long length = input.readLong();
  Object result = input.decodeUTF((int) length);
  if (enableResolve) {
    result = resolveObject(result);
  }
  registerObjectRead(result, nextHandle(), unshared);
  return result;
}

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

/**
 * Read a new String in UTF format from the receiver. Return the string
 * read.
 *
 * @param unshared
 *            read the object unshared
 * @return the string just read.
 *
 * @throws IOException
 *             If an IO exception happened when reading the String.
 */
private Object readNewLongString(boolean unshared) throws IOException {
  long length = input.readLong();
  Object result = input.decodeUTF((int) length);
  if (enableResolve) {
    result = resolveObject(result);
  }
  registerObjectRead(result, nextHandle(), unshared);
  return result;
}

相关文章

ObjectInputStream类方法