本文整理了Java中java.io.ObjectInputStream.discardData()
方法的一些代码示例,展示了ObjectInputStream.discardData()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ObjectInputStream.discardData()
方法的具体详情如下:
包路径:java.io.ObjectInputStream
类名称:ObjectInputStream
方法名:discardData
[英]Reads and discards block data and objects until TC_ENDBLOCKDATA is found.
[中]读取并丢弃块数据和对象,直到找到TC_ENDBLOCKDATA。
代码示例来源:origin: robovm/robovm
/**
* Reads a new proxy class descriptor from the receiver. It is assumed the
* proxy class descriptor has not been read yet (not a cyclic reference).
* Return the proxy class descriptor read.
*
* @return The {@code Class} read from the stream.
*
* @throws IOException
* If an IO exception happened when reading the class
* descriptor.
* @throws ClassNotFoundException
* If a class for one of the objects could not be found
*/
private Class<?> readNewProxyClassDesc() throws ClassNotFoundException,
IOException {
int count = input.readInt();
String[] interfaceNames = new String[count];
for (int i = 0; i < count; i++) {
interfaceNames[i] = input.readUTF();
}
Class<?> proxy = resolveProxyClass(interfaceNames);
// Consume unread class annotation data and TC_ENDBLOCKDATA
discardData();
return proxy;
}
代码示例来源:origin: robovm/robovm
discardData();
代码示例来源: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
discardData();
checkedSetSuperClassDesc(newClassDesc, readClassDesc());
return newClassDesc;
代码示例来源:origin: robovm/robovm
discardData();
} else {
primitiveData = emptyStream;
代码示例来源:origin: com.jtransc/jtransc-rt
/**
* Reads a new proxy class descriptor from the receiver. It is assumed the
* proxy class descriptor has not been read yet (not a cyclic reference).
* Return the proxy class descriptor read.
*
* @return The {@code Class} read from the stream.
* @throws IOException If an IO exception happened when reading the class
* descriptor.
* @throws ClassNotFoundException If a class for one of the objects could not be found
*/
private Class<?> readNewProxyClassDesc() throws ClassNotFoundException,
IOException {
int count = input.readInt();
String[] interfaceNames = new String[count];
for (int i = 0; i < count; i++) {
interfaceNames[i] = input.readUTF();
}
Class<?> proxy = resolveProxyClass(interfaceNames);
// Consume unread class annotation data and TC_ENDBLOCKDATA
discardData();
return proxy;
}
代码示例来源:origin: MobiVM/robovm
/**
* Reads a new proxy class descriptor from the receiver. It is assumed the
* proxy class descriptor has not been read yet (not a cyclic reference).
* Return the proxy class descriptor read.
*
* @return The {@code Class} read from the stream.
*
* @throws IOException
* If an IO exception happened when reading the class
* descriptor.
* @throws ClassNotFoundException
* If a class for one of the objects could not be found
*/
private Class<?> readNewProxyClassDesc() throws ClassNotFoundException,
IOException {
int count = input.readInt();
String[] interfaceNames = new String[count];
for (int i = 0; i < count; i++) {
interfaceNames[i] = input.readUTF();
}
Class<?> proxy = resolveProxyClass(interfaceNames);
// Consume unread class annotation data and TC_ENDBLOCKDATA
discardData();
return proxy;
}
代码示例来源:origin: ibinti/bugvm
/**
* Reads a new proxy class descriptor from the receiver. It is assumed the
* proxy class descriptor has not been read yet (not a cyclic reference).
* Return the proxy class descriptor read.
*
* @return The {@code Class} read from the stream.
*
* @throws IOException
* If an IO exception happened when reading the class
* descriptor.
* @throws ClassNotFoundException
* If a class for one of the objects could not be found
*/
private Class<?> readNewProxyClassDesc() throws ClassNotFoundException,
IOException {
int count = input.readInt();
String[] interfaceNames = new String[count];
for (int i = 0; i < count; i++) {
interfaceNames[i] = input.readUTF();
}
Class<?> proxy = resolveProxyClass(interfaceNames);
// Consume unread class annotation data and TC_ENDBLOCKDATA
discardData();
return proxy;
}
代码示例来源:origin: com.mobidevelop.robovm/robovm-rt
/**
* Reads a new proxy class descriptor from the receiver. It is assumed the
* proxy class descriptor has not been read yet (not a cyclic reference).
* Return the proxy class descriptor read.
*
* @return The {@code Class} read from the stream.
*
* @throws IOException
* If an IO exception happened when reading the class
* descriptor.
* @throws ClassNotFoundException
* If a class for one of the objects could not be found
*/
private Class<?> readNewProxyClassDesc() throws ClassNotFoundException,
IOException {
int count = input.readInt();
String[] interfaceNames = new String[count];
for (int i = 0; i < count; i++) {
interfaceNames[i] = input.readUTF();
}
Class<?> proxy = resolveProxyClass(interfaceNames);
// Consume unread class annotation data and TC_ENDBLOCKDATA
discardData();
return proxy;
}
代码示例来源:origin: com.gluonhq/robovm-rt
/**
* Reads a new proxy class descriptor from the receiver. It is assumed the
* proxy class descriptor has not been read yet (not a cyclic reference).
* Return the proxy class descriptor read.
*
* @return The {@code Class} read from the stream.
*
* @throws IOException
* If an IO exception happened when reading the class
* descriptor.
* @throws ClassNotFoundException
* If a class for one of the objects could not be found
*/
private Class<?> readNewProxyClassDesc() throws ClassNotFoundException,
IOException {
int count = input.readInt();
String[] interfaceNames = new String[count];
for (int i = 0; i < count; i++) {
interfaceNames[i] = input.readUTF();
}
Class<?> proxy = resolveProxyClass(interfaceNames);
// Consume unread class annotation data and TC_ENDBLOCKDATA
discardData();
return proxy;
}
代码示例来源:origin: com.bugvm/bugvm-rt
/**
* Reads a new proxy class descriptor from the receiver. It is assumed the
* proxy class descriptor has not been read yet (not a cyclic reference).
* Return the proxy class descriptor read.
*
* @return The {@code Class} read from the stream.
*
* @throws IOException
* If an IO exception happened when reading the class
* descriptor.
* @throws ClassNotFoundException
* If a class for one of the objects could not be found
*/
private Class<?> readNewProxyClassDesc() throws ClassNotFoundException,
IOException {
int count = input.readInt();
String[] interfaceNames = new String[count];
for (int i = 0; i < count; i++) {
interfaceNames[i] = input.readUTF();
}
Class<?> proxy = resolveProxyClass(interfaceNames);
// Consume unread class annotation data and TC_ENDBLOCKDATA
discardData();
return proxy;
}
代码示例来源:origin: FlexoVM/flexovm
/**
* Reads a new proxy class descriptor from the receiver. It is assumed the
* proxy class descriptor has not been read yet (not a cyclic reference).
* Return the proxy class descriptor read.
*
* @return The {@code Class} read from the stream.
*
* @throws IOException
* If an IO exception happened when reading the class
* descriptor.
* @throws ClassNotFoundException
* If a class for one of the objects could not be found
*/
private Class<?> readNewProxyClassDesc() throws ClassNotFoundException,
IOException {
int count = input.readInt();
String[] interfaceNames = new String[count];
for (int i = 0; i < count; i++) {
interfaceNames[i] = input.readUTF();
}
Class<?> proxy = resolveProxyClass(interfaceNames);
// Consume unread class annotation data and TC_ENDBLOCKDATA
discardData();
return proxy;
}
代码示例来源:origin: MobiVM/robovm
discardData();
代码示例来源:origin: ibinti/bugvm
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: MobiVM/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: com.gluonhq/robovm-rt
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: com.mobidevelop.robovm/robovm-rt
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: com.bugvm/bugvm-rt
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: com.jtransc/jtransc-rt
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: FlexoVM/flexovm
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;
}
内容来源于网络,如有侵权,请联系作者删除!