📄 iiopinputstream.java
字号:
* an override method with the modifier "final". * * @return the Object read from the stream. * * @see #ObjectInputStream() * @see #readObject * @since JDK 1.2 */ protected final Object readObjectOverride() throws OptionalDataException, ClassNotFoundException, IOException { return readObjectDelegate(); } /** * Override the actions of the final method "defaultReadObject()" * in ObjectInputStream. * @since JDK1.1.6 * * Read the non-static and non-transient fields of the current class * from this stream. This may only be called from the readObject method * of the class being deserialized. It will throw the NotActiveException * if it is called otherwise. * * @exception java.lang.ClassNotFoundException if the class of a serialized * object could not be found. * @exception IOException if an I/O error occurs. * @exception NotActiveException if the stream is not currently reading * objects. * @since JDK1.1 */ public final void defaultReadObjectDelegate() /* throws IOException, ClassNotFoundException, NotActiveException */ { try { if (currentObject == null || currentClassDesc == null) throw new NotActiveException("defaultReadObjectDelegate"); // The array will be null unless fields were retrieved // remotely because of a serializable version difference. // Bug fix for 4365188. See the definition of // defaultReadObjectFVDMembers for more information. if (defaultReadObjectFVDMembers != null && defaultReadObjectFVDMembers.length > 0) { // WARNING: Be very careful! What if some of // these fields actually have to do this, too? // This works because the defaultReadObjectFVDMembers // reference is passed to inputClassFields, but // there is no guarantee that // defaultReadObjectFVDMembers will point to the // same array after calling inputClassFields. // Use the remote fields to unmarshal. inputClassFields(currentObject, currentClass, currentClassDesc, defaultReadObjectFVDMembers, cbSender); } else { // Use the local fields to unmarshal. ObjectStreamField[] fields = currentClassDesc.getFieldsNoCopy(); if (fields.length > 0) { inputClassFields(currentObject, currentClass, fields, cbSender); //d11638 } } } catch(NotActiveException nae) { throwExceptionType(java.io.NotActiveException.class, nae.getMessage()); } catch(IOException ioe) { throwExceptionType(java.io.IOException.class, ioe.getMessage()); } catch(ClassNotFoundException cnfe) { throwExceptionType(java.lang.ClassNotFoundException.class, cnfe.getMessage()); } } /** * Override the actions of the final method "enableResolveObject()" * in ObjectInputStream. * @since JDK1.1.6 * * Enable the stream to allow objects read from the stream to be replaced. * If the stream is a trusted class it is allowed to enable replacment. * Trusted classes are those classes with a classLoader equals null. <p> * * When enabled the resolveObject method is called for every object * being deserialized. * * @exception SecurityException The classloader of this stream object is non-null. * @since JDK1.1 */ public final boolean enableResolveObjectDelegate(boolean enable) /* throws SecurityException */ { return false; } // The following three methods allow the implementing orbStream // to provide mark/reset behavior as defined in java.io.InputStream. public final void mark(int readAheadLimit) { orbStream.mark(readAheadLimit); } public final boolean markSupported() { return orbStream.markSupported(); } public final void reset() throws IOException { try { orbStream.reset(); } catch (Error e) { throw new IOException(e.getMessage()); } } public final int available() throws IOException{ return 0; // unreliable } public final void close() throws IOException{ // no op } public final int read() throws IOException{ try{ return (orbStream.read_octet() << 0) & 0x000000FF; } catch(Error e) { throw new IOException(e.getMessage()); } } public final int read(byte data[], int offset, int length) throws IOException{ try{ orbStream.read_octet_array(data, offset, length); return length; } catch(Error e) { throw new IOException(e.getMessage()); } } public final boolean readBoolean() throws IOException{ try{ return orbStream.read_boolean(); } catch(Error e) { throw new IOException(e.getMessage()); } } public final byte readByte() throws IOException{ try{ return orbStream.read_octet(); } catch(Error e) { throw new IOException(e.getMessage()); } } public final char readChar() throws IOException{ try{ return orbStream.read_wchar(); } catch(Error e) { throw new IOException(e.getMessage()); } } public final double readDouble() throws IOException{ try{ return orbStream.read_double(); } catch(Error e) { throw new IOException(e.getMessage()); } } public final float readFloat() throws IOException{ try{ return orbStream.read_float(); } catch(Error e) { throw new IOException(e.getMessage()); } } public final void readFully(byte data[]) throws IOException{// d11623 : implement readFully, required for serializing some core classes readFully(data, 0, data.length); } public final void readFully(byte data[], int offset, int size) throws IOException{// d11623 : implement readFully, required for serializing some core classes try{ orbStream.read_octet_array(data, offset, size); } catch(Error e) { throw new IOException(e.getMessage()); } } public final int readInt() throws IOException{ try{ return orbStream.read_long(); } catch(Error e) { throw new IOException(e.getMessage()); } } public final String readLine() throws IOException{ throw new IOException("Method readLine not supported"); } public final long readLong() throws IOException{ try{ return orbStream.read_longlong(); } catch(Error e) { throw new IOException(e.getMessage()); } } public final short readShort() throws IOException{ try{ return orbStream.read_short(); } catch(Error e) { throw new IOException(e.getMessage()); } } protected final void readStreamHeader() throws IOException, StreamCorruptedException{ // no op } public final int readUnsignedByte() throws IOException{ try{ return (orbStream.read_octet() << 0) & 0x000000FF; } catch(Error e) { throw new IOException(e.getMessage()); } } public final int readUnsignedShort() throws IOException{ try{ return (orbStream.read_ushort() << 0) & 0x0000FFFF; } catch(Error e) { throw new IOException(e.getMessage()); } } /** * Helper method for correcting the Kestrel bug 4367783 (dealing * with larger than 8-bit chars). The old behavior is preserved * in orbutil.IIOPInputStream_1_3 in order to interoperate with * our legacy ORBs. */ protected String internalReadUTF(org.omg.CORBA.portable.InputStream stream) { return stream.read_wstring(); } public final String readUTF() throws IOException{ try{ return internalReadUTF(orbStream); } catch(Error e) { throw new IOException(e.getMessage()); } } public final synchronized void registerValidation(ObjectInputValidation obj, int prio) throws NotActiveException, InvalidObjectException{ throw new Error("Method registerValidation not supported"); } protected final Class resolveClass(ObjectStreamClass v) throws IOException, ClassNotFoundException{ throw new IOException("Method resolveClass not supported"); } protected final Object resolveObject(Object obj) throws IOException{ throw new IOException("Method resolveObject not supported"); } public final int skipBytes(int len) throws IOException{ try{ byte buf[] = new byte[len]; orbStream.read_octet_array(buf, 0, len); return len; } catch(Error e) { throw new IOException(e.getMessage()); } } private Object inputObject(Class clz, String repositoryID, com.sun.org.omg.SendingContext.CodeBase sender, int offset) throws IOException, ClassNotFoundException { /* * Get the descriptor and then class of the incoming object. */ currentClassDesc = ObjectStreamClass.lookup(clz); currentClass = currentClassDesc.forClass(); //currentClassDesc.setClass(currentClass); if (currentClass == null) throw new ClassNotFoundException(currentClassDesc.getName()); try { /* If Externalizable, * Create an instance and tell it to read its data. * else, * Handle it as a serializable class. */ if (currentClassDesc.isExternalizable()) { try { currentObject = (currentClass == null) ? null : allocateNewObject(currentClass, currentClass); if (currentObject != null) { // Store this object and its beginning position // since there might be indirections to it while // it's been unmarshalled. activeRecursionMgr.addObject(offset, currentObject); // Read format version readByte(); Externalizable ext = (Externalizable)currentObject; ext.readExternal(this); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -