本文整理了Java中java.io.ObjectInputStream.readFieldDescriptors()
方法的一些代码示例,展示了ObjectInputStream.readFieldDescriptors()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ObjectInputStream.readFieldDescriptors()
方法的具体详情如下:
包路径:java.io.ObjectInputStream
类名称:ObjectInputStream
方法名:readFieldDescriptors
[英]Reads a collection of field descriptors (name, type name, etc) for the class descriptor cDesc (an ObjectStreamClass)
[中]读取类描述符cDesc(ObjectStreamClass)的字段描述符集合(名称、类型名称等)
代码示例来源: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: com.gluonhq/robovm-rt
/**
* 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: ibinti/bugvm
/**
* 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: com.mobidevelop.robovm/robovm-rt
/**
* 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: MobiVM/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: com.jtransc/jtransc-rt
/**
* 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: FlexoVM/flexovm
/**
* 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: com.bugvm/bugvm-rt
/**
* 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;
}
内容来源于网络,如有侵权,请联系作者删除!