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