home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD 31 / SUPERCDa.iso / Inet / HotJava / hjava.exe / Windows / resource / jre / lib / rt.jar / java / io / ObjectInputStream.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-11-11  |  15.2 KB  |  867 lines

  1. package java.io;
  2.  
  3. import java.util.Vector;
  4. import sun.io.ObjectInputStreamDelegate;
  5.  
  6. public class ObjectInputStream extends InputStream implements ObjectInput, ObjectStreamConstants {
  7.    // $FF: renamed from: in java.io.InputStream
  8.    private InputStream field_0;
  9.    private int count;
  10.    private boolean blockDataMode;
  11.    private byte[] buffer;
  12.    private DataInputStream dis;
  13.    private IOException abortIOException;
  14.    private ClassNotFoundException abortClassNotFoundException;
  15.    private Object currentObject;
  16.    private ObjectStreamClass currentClassDesc;
  17.    private Class currentClass;
  18.    ObjectStreamClass[] classdesc;
  19.    Class[] classes;
  20.    int spClass;
  21.    private Vector wireHandle2Object;
  22.    private int nextWireOffset;
  23.    private Vector callbacks;
  24.    private int recursionDepth;
  25.    private byte currCode;
  26.    boolean enableResolve;
  27.    private boolean isTrustedSubclass = false;
  28.  
  29.    public ObjectInputStream(InputStream var1) throws IOException, StreamCorruptedException {
  30.       if (this instanceof ObjectInputStreamDelegate && this.getClass().getClassLoader() == null) {
  31.          this.isTrustedSubclass = true;
  32.       } else {
  33.          this.field_0 = var1;
  34.          this.dis = new DataInputStream(this);
  35.          this.readStreamHeader();
  36.          this.resetStream();
  37.       }
  38.    }
  39.  
  40.    public final Object readObject() throws OptionalDataException, ClassNotFoundException, IOException {
  41.       return this.isTrustedSubclass ? ((ObjectInputStreamDelegate)this).readObjectDelegate() : this.readObject(true);
  42.    }
  43.  
  44.    private final Object readObject(boolean var1) throws OptionalDataException, ClassNotFoundException, IOException {
  45.       if (this.blockDataMode) {
  46.          if (this.count == 0) {
  47.             this.refill();
  48.          }
  49.  
  50.          if (this.count > 0) {
  51.             throw new OptionalDataException(this.count);
  52.          }
  53.       }
  54.  
  55.       this.peekCode();
  56.       Object var2 = this.currentObject;
  57.       ObjectStreamClass var3 = this.currentClassDesc;
  58.       boolean var4 = this.setBlockData(false);
  59.       ++this.recursionDepth;
  60.       Object var5 = null;
  61.       byte var6 = this.readCode();
  62.  
  63.       try {
  64.          int var9 = -1;
  65.          switch (var6) {
  66.             case 112:
  67.                var5 = null;
  68.                break;
  69.             case 113:
  70.                var9 = this.readInt() - 8257536;
  71.  
  72.                try {
  73.                   var5 = this.wireHandle2Object.elementAt(var9);
  74.                   break;
  75.                } catch (ArrayIndexOutOfBoundsException var20) {
  76.                   throw new StreamCorruptedException("Reference to object never serialized.");
  77.                }
  78.             case 114:
  79.                var5 = this.inputClassDescriptor();
  80.                break;
  81.             case 115:
  82.                var9 = this.inputObject(var1);
  83.                var5 = this.currentObject;
  84.                if (this.enableResolve) {
  85.                   var5 = this.resolveObject(var5);
  86.                   this.wireHandle2Object.setElementAt(var5, var9);
  87.                }
  88.                break;
  89.             case 116:
  90.                var5 = this.readUTF();
  91.                Object var29 = var5;
  92.                var9 = this.assignWireOffset(var5);
  93.                if (this.enableResolve) {
  94.                   var5 = this.resolveObject(var5);
  95.                }
  96.  
  97.                if (var5 != var29) {
  98.                   this.wireHandle2Object.setElementAt(var5, var9);
  99.                }
  100.                break;
  101.             case 117:
  102.                var9 = this.inputArray(var1);
  103.                var5 = this.currentObject;
  104.                if (this.enableResolve) {
  105.                   var5 = this.resolveObject(var5);
  106.                }
  107.  
  108.                if (var5 != this.currentObject) {
  109.                   this.wireHandle2Object.setElementAt(var5, var9);
  110.                }
  111.                break;
  112.             case 118:
  113.                ObjectStreamClass var10 = (ObjectStreamClass)this.readObject(var1);
  114.                if (var10 == null) {
  115.                   throw new StreamCorruptedException("Class not in stream");
  116.                }
  117.  
  118.                var5 = var10.forClass();
  119.                if (var5 == null && var1) {
  120.                   throw new ClassNotFoundException(var10.getName());
  121.                }
  122.  
  123.                this.assignWireOffset(var5);
  124.                break;
  125.             case 119:
  126.             case 122:
  127.                if (var6 == 122) {
  128.                   int var30 = this.field_0.read();
  129.                   int var12 = this.field_0.read();
  130.                   int var13 = this.field_0.read();
  131.                   int var14 = this.field_0.read();
  132.                   if ((var30 | var12 | var13 | var14) < 0) {
  133.                      throw new StreamCorruptedException("EOF expecting count");
  134.                   }
  135.  
  136.                   this.count = var30 << 24 | var12 << 16 | var13 << 8 | var14;
  137.                   if (this.count < 0) {
  138.                      throw new StreamCorruptedException("Negative block data size");
  139.                   }
  140.                } else {
  141.                   this.count = this.field_0.read();
  142.                   if (this.count < 0) {
  143.                      throw new StreamCorruptedException("EOF expecting count");
  144.                   }
  145.                }
  146.  
  147.                if (!var4) {
  148.                   throw new StreamCorruptedException("Unexpected blockdata");
  149.                }
  150.  
  151.                throw new OptionalDataException(this.count);
  152.             case 120:
  153.                if (!var4) {
  154.                   throw new StreamCorruptedException("Unexpected end of block data");
  155.                }
  156.  
  157.                this.pushbackCode((byte)120);
  158.                this.count = -1;
  159.                throw new OptionalDataException(true);
  160.             case 121:
  161.             default:
  162.                throw new StreamCorruptedException("Unknown code in readObject " + var6);
  163.             case 123:
  164.                this.resetStream();
  165.                IOException var11 = (IOException)this.readObject();
  166.                this.resetStream();
  167.                throw new WriteAbortedException("Writing aborted by exception", var11);
  168.          }
  169.       } catch (OptionalDataException var21) {
  170.          throw var21;
  171.       } catch (IOException var22) {
  172.          if (this.abortIOException == null && this.abortClassNotFoundException == null) {
  173.             this.abortIOException = var22;
  174.          }
  175.       } catch (ClassNotFoundException var23) {
  176.          if (this.abortIOException == null && this.abortClassNotFoundException == null) {
  177.             this.abortClassNotFoundException = var23;
  178.          }
  179.       } finally {
  180.          --this.recursionDepth;
  181.          this.currentObject = var2;
  182.          this.currentClassDesc = var3;
  183.          this.currentClass = this.currentClassDesc != null ? this.currentClassDesc.forClass() : null;
  184.          this.setBlockData(var4);
  185.       }
  186.  
  187.       IOException var7 = this.abortIOException;
  188.       if (this.recursionDepth == 0) {
  189.          this.abortIOException = null;
  190.       }
  191.  
  192.       if (var7 != null) {
  193.          throw var7;
  194.       } else {
  195.          ClassNotFoundException var8 = this.abortClassNotFoundException;
  196.          if (this.recursionDepth == 0) {
  197.             this.abortClassNotFoundException = null;
  198.          }
  199.  
  200.          if (var8 != null) {
  201.             throw var8;
  202.          } else {
  203.             if (this.recursionDepth == 0) {
  204.                this.doValidations();
  205.             }
  206.  
  207.             return var5;
  208.          }
  209.       }
  210.    }
  211.  
  212.    public final void defaultReadObject() throws IOException, ClassNotFoundException, NotActiveException {
  213.       if (this.isTrustedSubclass) {
  214.          ((ObjectInputStreamDelegate)this).defaultReadObjectDelegate();
  215.       } else if (this.currentObject != null && this.currentClassDesc != null) {
  216.          if (this.currentClassDesc.getFieldSequence() != null) {
  217.             boolean var1 = this.setBlockData(false);
  218.             this.inputClassFields(this.currentObject, this.currentClass, this.currentClassDesc.getFieldSequence());
  219.             this.setBlockData(var1);
  220.          }
  221.  
  222.       } else {
  223.          throw new NotActiveException("defaultReadObject");
  224.       }
  225.    }
  226.  
  227.    public synchronized void registerValidation(ObjectInputValidation var1, int var2) throws NotActiveException, InvalidObjectException {
  228.       if (this.recursionDepth == 0) {
  229.          throw new NotActiveException("readObject not Active");
  230.       } else if (var1 == null) {
  231.          throw new InvalidObjectException("Null is not a valid callback object");
  232.       } else {
  233.          ValidationCallback var3 = new ValidationCallback(var1, var2);
  234.          if (this.callbacks == null) {
  235.             this.callbacks = new Vector(100, 100);
  236.          }
  237.  
  238.          if (!this.callbacks.isEmpty() && ((ValidationCallback)this.callbacks.lastElement()).priority < var2) {
  239.             int var4 = this.callbacks.size();
  240.  
  241.             for(int var5 = 0; var5 < var4; ++var5) {
  242.                ValidationCallback var6 = (ValidationCallback)this.callbacks.elementAt(var5);
  243.                if (var6.priority <= var2) {
  244.                   this.callbacks.insertElementAt(var3, var5);
  245.                   return;
  246.                }
  247.             }
  248.  
  249.          } else {
  250.             this.callbacks.addElement(var3);
  251.          }
  252.       }
  253.    }
  254.  
  255.    private void doValidations() throws InvalidObjectException {
  256.       if (this.callbacks != null) {
  257.          int var1 = this.callbacks.size();
  258.          if (var1 != 0) {
  259.             for(int var2 = 0; var2 < var1; ++var2) {
  260.                ValidationCallback var3 = (ValidationCallback)this.callbacks.elementAt(var2);
  261.                var3.callback.validateObject();
  262.             }
  263.  
  264.             this.callbacks.setSize(0);
  265.          }
  266.       }
  267.    }
  268.  
  269.    protected Class resolveClass(ObjectStreamClass var1) throws IOException, ClassNotFoundException {
  270.       return this.loadClass0((Class)null, var1.getName());
  271.    }
  272.  
  273.    private native Class loadClass0(Class var1, String var2) throws ClassNotFoundException;
  274.  
  275.    protected Object resolveObject(Object var1) throws IOException {
  276.       return var1;
  277.    }
  278.  
  279.    protected final boolean enableResolveObject(boolean var1) throws SecurityException {
  280.       if (this.isTrustedSubclass) {
  281.          return ((ObjectInputStreamDelegate)this).enableResolveObjectDelegate(var1);
  282.       } else {
  283.          boolean var2 = this.enableResolve;
  284.          if (var1) {
  285.             ClassLoader var3 = this.getClass().getClassLoader();
  286.             if (var3 == null) {
  287.                this.enableResolve = true;
  288.                return var2;
  289.             } else {
  290.                throw new SecurityException("Not trusted class");
  291.             }
  292.          } else {
  293.             this.enableResolve = false;
  294.             return var2;
  295.          }
  296.       }
  297.    }
  298.  
  299.    protected void readStreamHeader() throws IOException, StreamCorruptedException {
  300.       short var1 = this.readShort();
  301.       short var2 = this.readShort();
  302.       if (var1 != -21267) {
  303.          throw new StreamCorruptedException("InputStream does not contain a serialized object");
  304.       } else if (var2 != 5) {
  305.          throw new StreamCorruptedException("Version Mismatch, Expected " + 5 + " and got " + var2);
  306.       }
  307.    }
  308.  
  309.    private ObjectStreamClass inputClassDescriptor() throws IOException, InvalidClassException, ClassNotFoundException {
  310.       String var2 = this.readUTF();
  311.       long var3 = this.readLong();
  312.       ObjectStreamClass var5 = new ObjectStreamClass(var2, var3);
  313.       this.assignWireOffset(var5);
  314.       var5.read(this);
  315.       boolean var6 = this.setBlockData(true);
  316.  
  317.       Class var1;
  318.       try {
  319.          var1 = this.resolveClass(var5);
  320.       } catch (ClassNotFoundException var8) {
  321.          var1 = null;
  322.       } catch (NoClassDefFoundError var9) {
  323.          var1 = null;
  324.       }
  325.  
  326.       this.SkipToEndOfBlockData();
  327.       this.setBlockData(var6);
  328.       var5.setClass(var1);
  329.       ObjectStreamClass var7 = (ObjectStreamClass)this.readObject();
  330.       var5.setSuperclass(var7);
  331.       return var5;
  332.    }
  333.  
  334.    private int inputArray(boolean var1) throws IOException, ClassNotFoundException {
  335.       ObjectStreamClass var2 = (ObjectStreamClass)this.readObject();
  336.       Class var3 = var2.forClass();
  337.       if (var3 == null && var1) {
  338.          throw new ClassNotFoundException(var2.getName());
  339.       } else {
  340.          int var4 = this.readInt();
  341.          this.currentObject = var3 == null ? null : allocateNewArray(var3, var4);
  342.          int var5 = this.assignWireOffset(this.currentObject);
  343.          if (var3 != null && var3.getComponentType().isPrimitive()) {
  344.             Class var20 = var3.getComponentType();
  345.             if (this.buffer == null) {
  346.                this.buffer = new byte[1024];
  347.             }
  348.  
  349.             int var21 = this.buffer.length;
  350.             int var22 = this.buffer.length;
  351.             if (var20 == Boolean.TYPE) {
  352.                boolean[] var10 = (boolean[])this.currentObject;
  353.  
  354.                for(int var13 = 0; var13 < var4; ++var13) {
  355.                   if (var21 >= var22) {
  356.                      int var11 = Math.min(var4 - var13, var22);
  357.                      this.readFully(this.buffer, 0, var11);
  358.                      var21 = 0;
  359.                   }
  360.  
  361.                   var10[var13] = this.buffer[var21] != 0;
  362.                   ++var21;
  363.                }
  364.             } else if (var20 == Byte.TYPE) {
  365.                byte[] var23 = (byte[])this.currentObject;
  366.  
  367.                int var12;
  368.                for(int var30 = 0; var30 < var4; var30 += var12) {
  369.                   var12 = Math.min(var4 - var30, var22);
  370.                   this.readFully(this.buffer, 0, var12);
  371.                   System.arraycopy(this.buffer, 0, var23, var30, var12);
  372.                }
  373.             } else if (var20 == Short.TYPE) {
  374.                short[] var24 = (short[])this.currentObject;
  375.  
  376.                for(int var14 = 0; var14 < var4; ++var14) {
  377.                   if (var21 > var22 - 2) {
  378.                      int var31 = Math.min((var4 - var14) * 2, var22);
  379.                      this.readFully(this.buffer, 0, var31);
  380.                      var21 = 0;
  381.                   }
  382.  
  383.                   var24[var14] = (short)(((this.buffer[var21] & 255) << 8) + (this.buffer[var21 + 1] & 255));
  384.                   var21 += 2;
  385.                }
  386.             } else if (var20 == Integer.TYPE) {
  387.                int[] var25 = (int[])this.currentObject;
  388.  
  389.                for(int var15 = 0; var15 < var4; ++var15) {
  390.                   if (var21 > var22 - 4) {
  391.                      int var32 = Math.min((var4 - var15) * 4, var22);
  392.                      this.readFully(this.buffer, 0, var32);
  393.                      var21 = 0;
  394.                   }
  395.  
  396.                   var25[var15] = ((this.buffer[var21] & 255) << 24) + ((this.buffer[var21 + 1] & 255) << 16) + ((this.buffer[var21 + 2] & 255) << 8) + (this.buffer[var21 + 3] & 255);
  397.                   var21 += 4;
  398.                }
  399.             } else if (var20 == Long.TYPE) {
  400.                long[] var26 = (long[])this.currentObject;
  401.  
  402.                for(int var16 = 0; var16 < var4; ++var16) {
  403.                   if (var21 > var22 - 8) {
  404.                      int var33 = Math.min((var4 - var16) * 8, var22);
  405.                      this.readFully(this.buffer, 0, var33);
  406.                      var21 = 0;
  407.                   }
  408.  
  409.                   int var34 = ((this.buffer[var21] & 255) << 24) + ((this.buffer[var21 + 1] & 255) << 16) + ((this.buffer[var21 + 2] & 255) << 8) + (this.buffer[var21 + 3] & 255);
  410.                   int var40 = ((this.buffer[var21 + 4] & 255) << 24) + ((this.buffer[var21 + 5] & 255) << 16) + ((this.buffer[var21 + 6] & 255) << 8) + (this.buffer[var21 + 7] & 255);
  411.                   var26[var16] = ((long)var34 << 32) + ((long)var40 & 4294967295L);
  412.                   var21 += 8;
  413.                }
  414.             } else if (var20 == Float.TYPE) {
  415.                float[] var27 = (float[])this.currentObject;
  416.  
  417.                for(int var17 = 0; var17 < var4; ++var17) {
  418.                   if (var21 > var22 - 4) {
  419.                      int var35 = Math.min((var4 - var17) * 4, var22);
  420.                      this.readFully(this.buffer, 0, var35);
  421.                      var21 = 0;
  422.                   }
  423.  
  424.                   int var36 = ((this.buffer[var21] & 255) << 24) + ((this.buffer[var21 + 1] & 255) << 16) + ((this.buffer[var21 + 2] & 255) << 8) + (this.buffer[var21 + 3] & 255);
  425.                   var21 += 4;
  426.                   var27[var17] = Float.intBitsToFloat(var36);
  427.                }
  428.             } else if (var20 == Double.TYPE) {
  429.                double[] var28 = (double[])this.currentObject;
  430.  
  431.                for(int var18 = 0; var18 < var4; ++var18) {
  432.                   if (var21 > var22 - 8) {
  433.                      int var37 = Math.min((var4 - var18) * 8, var22);
  434.                      this.readFully(this.buffer, 0, var37);
  435.                      var21 = 0;
  436.                   }
  437.  
  438.                   int var38 = ((this.buffer[var21] & 255) << 24) + ((this.buffer[var21 + 1] & 255) << 16) + ((this.buffer[var21 + 2] & 255) << 8) + (this.buffer[var21 + 3] & 255);
  439.                   int var41 = ((this.buffer[var21 + 4] & 255) << 24) + ((this.buffer[var21 + 5] & 255) << 16) + ((this.buffer[var21 + 6] & 255) << 8) + (this.buffer[var21 + 7] & 255);
  440.                   var21 += 8;
  441.                   var28[var18] = Double.longBitsToDouble(((long)var38 << 32) + ((long)var41 & 4294967295L));
  442.                }
  443.             } else {
  444.                if (var20 != Character.TYPE) {
  445.                   throw new InvalidClassException(var3.getName());
  446.                }
  447.  
  448.                char[] var29 = (char[])this.currentObject;
  449.  
  450.                for(int var19 = 0; var19 < var4; ++var19) {
  451.                   if (var21 > var22 - 2) {
  452.                      int var39 = Math.min((var4 - var19) * 2, var22);
  453.                      this.readFully(this.buffer, 0, var39);
  454.                      var21 = 0;
  455.                   }
  456.  
  457.                   var29[var19] = (char)(((this.buffer[var21] & 255) << 8) + (this.buffer[var21 + 1] & 255));
  458.                   var21 += 2;
  459.                }
  460.             }
  461.          } else {
  462.             Object[] var7 = this.currentObject;
  463.             boolean var8 = var3 != null;
  464.  
  465.             for(int var6 = 0; var6 < var4; ++var6) {
  466.                Object var9 = this.readObject(var8);
  467.                if (var7 != null) {
  468.                   var7[var6] = var9;
  469.                }
  470.             }
  471.          }
  472.  
  473.          return var5;
  474.       }
  475.    }
  476.  
  477.    private int inputObject(boolean var1) throws IOException, ClassNotFoundException {
  478.       int var2 = -1;
  479.       this.currentClassDesc = (ObjectStreamClass)this.readObject();
  480.       this.currentClass = this.currentClassDesc.forClass();
  481.       if (this.currentClass != null || !var1 && (!this.currentClassDesc.isExternalizable() || this.currentClassDesc.hasExternalizableBlockDataMode())) {
  482.          if (this.currentClassDesc.isExternalizable()) {
  483.             try {
  484.                this.currentObject = this.currentClass == null ? null : allocateNewObject(this.currentClass, this.currentClass);
  485.                var2 = this.assignWireOffset(this.currentObject);
  486.                boolean var3 = this.blockDataMode;
  487.                if (this.currentClassDesc.hasExternalizableBlockDataMode()) {
  488.                   var3 = this.setBlockData(true);
  489.                }
  490.  
  491.                try {
  492.                   if (this.currentObject != null) {
  493.                      Externalizable var6 = (Externalizable)this.currentObject;
  494.                      var6.readExternal(this);
  495.                   }
  496.                } finally {
  497.                   if (this.currentClassDesc.hasExternalizableBlockDataMode()) {
  498.                      this.SkipToEndOfBlockData();
  499.                      this.setBlockData(var3);
  500.                   }
  501.  
  502.                }
  503.             } catch (IllegalAccessException var29) {
  504.                throw new InvalidClassException(this.currentClass.getName(), "IllegalAccessException");
  505.             } catch (InstantiationException var30) {
  506.                throw new InvalidClassException(this.currentClass.getName(), "InstantiationException");
  507.             }
  508.          } else {
  509.             ObjectStreamClass var33 = this.currentClassDesc;
  510.             Class var4 = this.currentClass;
  511.             int var5 = this.spClass;
  512.             var33 = this.currentClassDesc;
  513.  
  514.             for(var4 = this.currentClass; var33 != null; var33 = var33.getSuperclass()) {
  515.                Class var36 = var33.forClass();
  516.  
  517.                Class var7;
  518.                for(var7 = var4; var7 != null && var36 != var7; var7 = var7.getSuperclass()) {
  519.                }
  520.  
  521.                ++this.spClass;
  522.                if (this.spClass >= this.classes.length) {
  523.                   int var8 = this.classes.length * 2;
  524.                   Class[] var9 = new Class[var8];
  525.                   ObjectStreamClass[] var10 = new ObjectStreamClass[var8];
  526.                   System.arraycopy(this.classes, 0, var9, 0, this.classes.length);
  527.                   System.arraycopy(this.classdesc, 0, var10, 0, this.classes.length);
  528.                   this.classes = var9;
  529.                   this.classdesc = var10;
  530.                }
  531.  
  532.                if (var7 == null) {
  533.                   this.classdesc[this.spClass] = var33;
  534.                   this.classes[this.spClass] = null;
  535.                } else {
  536.                   this.classdesc[this.spClass] = var33;
  537.                   this.classes[this.spClass] = var7;
  538.                   var4 = var7.getSuperclass();
  539.                }
  540.             }
  541.  
  542.             try {
  543.                this.currentObject = this.currentClass == null ? null : allocateNewObject(this.currentClass, var4);
  544.             } catch (NoSuchMethodError var25) {
  545.                throw new InvalidClassException(var4.getName(), "NoSuchMethodError");
  546.             } catch (IllegalAccessException var26) {
  547.                throw new InvalidClassException(var4.getName(), "IllegalAccessException");
  548.             } catch (InstantiationException var27) {
  549.                throw new InvalidClassException(var4.getName(), "InstantiationException");
  550.             }
  551.  
  552.             var2 = this.assignWireOffset(this.currentObject);
  553.  
  554.             try {
  555.                for(this.spClass = this.spClass; this.spClass > var5; --this.spClass) {
  556.                   this.currentClassDesc = this.classdesc[this.spClass];
  557.                   this.currentClass = this.classes[this.spClass];
  558.                   if (this.classes[this.spClass] != null) {
  559.                      this.setBlockData(true);
  560.                      this.currentClassDesc.localClassDescriptor();
  561.                      if (!this.invokeObjectReader(this.currentObject, this.currentClass)) {
  562.                         this.defaultReadObject();
  563.                      }
  564.                   } else if (this.currentClassDesc.getFieldSequence() != null) {
  565.                      boolean var37 = this.setBlockData(false);
  566.                      this.inputClassFields((Object)null, this.currentClass, this.currentClassDesc.getFieldSequence());
  567.                      this.setBlockData(var37);
  568.                   }
  569.  
  570.                   if (this.currentClassDesc.hasWriteObject()) {
  571.                      this.setBlockData(true);
  572.                      this.SkipToEndOfBlockData();
  573.                   }
  574.  
  575.                   this.setBlockData(false);
  576.                }
  577.             } finally {
  578.                this.spClass = var5;
  579.             }
  580.          }
  581.  
  582.          return var2;
  583.       } else {
  584.          throw new ClassNotFoundException(this.currentClassDesc.getName());
  585.       }
  586.    }
  587.  
  588.    private void SkipToEndOfBlockData() throws IOException, ClassNotFoundException {
  589.       while(this.peekCode() != 120) {
  590.          try {
  591.             this.readObject(false);
  592.          } catch (OptionalDataException var2) {
  593.             if (var2.length > 0) {
  594.                ((InputStream)this).skip((long)var2.length);
  595.             }
  596.          }
  597.       }
  598.  
  599.       this.readCode();
  600.    }
  601.  
  602.    private void resetStream() throws IOException {
  603.       if (this.wireHandle2Object == null) {
  604.          this.wireHandle2Object = new Vector(100, 100);
  605.       } else {
  606.          this.wireHandle2Object.setSize(0);
  607.       }
  608.  
  609.       this.nextWireOffset = 0;
  610.       if (this.classes == null) {
  611.          this.classes = new Class[20];
  612.       } else {
  613.          for(int var1 = 0; var1 < this.classes.length; ++var1) {
  614.             this.classes[var1] = null;
  615.          }
  616.       }
  617.  
  618.       if (this.classdesc == null) {
  619.          this.classdesc = new ObjectStreamClass[20];
  620.       } else {
  621.          for(int var2 = 0; var2 < this.classdesc.length; ++var2) {
  622.             this.classdesc[var2] = null;
  623.          }
  624.       }
  625.  
  626.       this.spClass = 0;
  627.       this.setBlockData(true);
  628.       if (this.callbacks != null) {
  629.          this.callbacks.setSize(0);
  630.       }
  631.  
  632.    }
  633.  
  634.    private int assignWireOffset(Object var1) throws IOException {
  635.       this.wireHandle2Object.addElement(var1);
  636.       if (++this.nextWireOffset != this.wireHandle2Object.size()) {
  637.          throw new StreamCorruptedException("Elements not assigned in order");
  638.       } else {
  639.          return this.nextWireOffset - 1;
  640.       }
  641.    }
  642.  
  643.    private byte peekCode() throws IOException, StreamCorruptedException {
  644.       while(this.currCode == 0) {
  645.          int var1 = this.field_0.read();
  646.          if (var1 < 0) {
  647.             throw new EOFException("Expecting code");
  648.          }
  649.  
  650.          this.currCode = (byte)var1;
  651.          if (this.currCode >= 112 && this.currCode <= 123) {
  652.             if (this.currCode != 121) {
  653.                continue;
  654.             }
  655.  
  656.             if (this.recursionDepth == 0 && this.currentObject == null && this.currentClassDesc == null) {
  657.                this.resetStream();
  658.                this.currCode = 0;
  659.                continue;
  660.             }
  661.  
  662.             throw new StreamCorruptedException("Illegal stream state for reset");
  663.          }
  664.  
  665.          throw new StreamCorruptedException("Type code out of range, is " + this.currCode);
  666.       }
  667.  
  668.       return this.currCode;
  669.    }
  670.  
  671.    private byte readCode() throws IOException, StreamCorruptedException {
  672.       byte var1 = this.peekCode();
  673.       this.currCode = 0;
  674.       return var1;
  675.    }
  676.  
  677.    private void pushbackCode(byte var1) {
  678.       this.currCode = var1;
  679.    }
  680.  
  681.    private boolean setBlockData(boolean var1) throws IOException {
  682.       if (this.blockDataMode == var1) {
  683.          return var1;
  684.       } else if (this.blockDataMode && this.count > 0) {
  685.          throw new StreamCorruptedException("Unread data");
  686.       } else {
  687.          this.count = var1 ? 0 : -1;
  688.          this.blockDataMode = var1;
  689.          return !var1;
  690.       }
  691.    }
  692.  
  693.    public int read() throws IOException {
  694.       int var1;
  695.       if (!this.blockDataMode) {
  696.          var1 = this.field_0.read();
  697.       } else {
  698.          while(this.count == 0) {
  699.             this.refill();
  700.          }
  701.  
  702.          if (this.count < 0) {
  703.             return -1;
  704.          }
  705.  
  706.          var1 = this.field_0.read();
  707.          if (var1 >= 0) {
  708.             --this.count;
  709.          }
  710.       }
  711.  
  712.       return var1;
  713.    }
  714.  
  715.    private void refill() throws IOException {
  716.       this.count = -1;
  717.  
  718.       byte var1;
  719.       try {
  720.          var1 = this.peekCode();
  721.       } catch (EOFException var7) {
  722.          return;
  723.       }
  724.  
  725.       if (var1 == 119) {
  726.          var1 = this.readCode();
  727.          int var10 = this.field_0.read();
  728.          if (var10 < 0) {
  729.             throw new StreamCorruptedException("EOF expecting count");
  730.          } else {
  731.             this.count = var10 & 255;
  732.          }
  733.       } else {
  734.          if (var1 == 122) {
  735.             var1 = this.readCode();
  736.             int var2 = this.field_0.read();
  737.             int var3 = this.field_0.read();
  738.             int var4 = this.field_0.read();
  739.             int var5 = this.field_0.read();
  740.             if ((var2 | var3 | var4 | var5) < 0) {
  741.                throw new StreamCorruptedException("EOF expecting count");
  742.             }
  743.  
  744.             int var6 = var2 << 24 | var3 << 16 | var4 << 8 | var5;
  745.             if (var6 < 0) {
  746.                throw new StreamCorruptedException("Negative block data size");
  747.             }
  748.  
  749.             this.count = var6;
  750.          }
  751.  
  752.       }
  753.    }
  754.  
  755.    public int read(byte[] var1, int var2, int var3) throws IOException {
  756.       if (var3 < 0) {
  757.          throw new IndexOutOfBoundsException();
  758.       } else if (!this.blockDataMode) {
  759.          return this.field_0.read(var1, var2, var3);
  760.       } else {
  761.          while(this.count == 0) {
  762.             this.refill();
  763.          }
  764.  
  765.          if (this.count < 0) {
  766.             return -1;
  767.          } else {
  768.             int var5 = Math.min(var3, this.count);
  769.             int var4 = this.field_0.read(var1, var2, var5);
  770.             if (var4 > 0) {
  771.                this.count -= var4;
  772.             }
  773.  
  774.             return var4;
  775.          }
  776.       }
  777.    }
  778.  
  779.    public int available() throws IOException {
  780.       if (this.blockDataMode) {
  781.          if (this.count == 0 && this.field_0.available() > 0) {
  782.             this.refill();
  783.          }
  784.  
  785.          return this.count >= 0 ? this.count : 0;
  786.       } else {
  787.          return 0;
  788.       }
  789.    }
  790.  
  791.    public void close() throws IOException {
  792.       this.field_0.close();
  793.    }
  794.  
  795.    public boolean readBoolean() throws IOException {
  796.       return this.dis.readBoolean();
  797.    }
  798.  
  799.    public byte readByte() throws IOException {
  800.       return this.dis.readByte();
  801.    }
  802.  
  803.    public int readUnsignedByte() throws IOException {
  804.       return this.dis.readUnsignedByte();
  805.    }
  806.  
  807.    public short readShort() throws IOException {
  808.       return this.dis.readShort();
  809.    }
  810.  
  811.    public int readUnsignedShort() throws IOException {
  812.       return this.dis.readUnsignedShort();
  813.    }
  814.  
  815.    public char readChar() throws IOException {
  816.       return this.dis.readChar();
  817.    }
  818.  
  819.    public int readInt() throws IOException {
  820.       return this.dis.readInt();
  821.    }
  822.  
  823.    public long readLong() throws IOException {
  824.       return this.dis.readLong();
  825.    }
  826.  
  827.    public float readFloat() throws IOException {
  828.       return this.dis.readFloat();
  829.    }
  830.  
  831.    public double readDouble() throws IOException {
  832.       return this.dis.readDouble();
  833.    }
  834.  
  835.    public void readFully(byte[] var1) throws IOException {
  836.       this.dis.readFully(var1);
  837.    }
  838.  
  839.    public void readFully(byte[] var1, int var2, int var3) throws IOException {
  840.       if (var3 < 0) {
  841.          throw new IndexOutOfBoundsException();
  842.       } else {
  843.          this.dis.readFully(var1, var2, var3);
  844.       }
  845.    }
  846.  
  847.    public int skipBytes(int var1) throws IOException {
  848.       return this.dis.skipBytes(var1);
  849.    }
  850.  
  851.    public String readLine() throws IOException {
  852.       return this.dis.readLine();
  853.    }
  854.  
  855.    public String readUTF() throws IOException {
  856.       return this.dis.readUTF();
  857.    }
  858.  
  859.    private native void inputClassFields(Object var1, Class var2, int[] var3) throws InvalidClassException, StreamCorruptedException, ClassNotFoundException, IOException;
  860.  
  861.    private static native Object allocateNewObject(Class var0, Class var1) throws InstantiationException, IllegalAccessException;
  862.  
  863.    private static native Object allocateNewArray(Class var0, int var1);
  864.  
  865.    private native boolean invokeObjectReader(Object var1, Class var2) throws InvalidClassException, StreamCorruptedException, ClassNotFoundException, IOException;
  866. }
  867.