private long computeInterfaceHash(){
  long hash=0;
  ByteArrayOutputStream sink=new ByteArrayOutputStream(512);
  try {
    MessageDigest md=MessageDigest.getInstance("SHA");
    DataOutputStream out=new DataOutputStream(new DigestOutputStream(sink,md));
    out.writeInt(INTERFACE_HASH_STUB_VERSION);
    for (    Method method : remoteMethods) {
      MethodDoc methodDoc=method.methodDoc();
      out.writeUTF(methodDoc.name());
      out.writeUTF(Util.methodDescriptorOf(methodDoc));
      ClassDoc exceptions[]=methodDoc.thrownExceptions();
      Arrays.sort(exceptions,new ClassDocComparator());
      for (      ClassDoc ex : exceptions) {
        out.writeUTF(Util.binaryNameOf(ex));
      }
    }
    out.flush();
    byte hashArray[]=md.digest();
    for (int i=0; i < Math.min(8,hashArray.length); i++) {
      hash+=((long)(hashArray[i] & 0xFF)) << (i * 8);
    }
  }
 catch (  IOException e) {
    throw new AssertionError(e);
  }
catch (  NoSuchAlgorithmException e) {
    throw new AssertionError(e);
  }
  return hash;
}

private long computeInterfaceHash ( ) { long hash = 0 ; ByteArrayOutputStream sink = new ByteArrayOutputStream ( 512 ) ; try { MessageDigest md = MessageDigest . getInstance ( "SHA" ) ; DataOutputStream out = new DataOutputStream ( new DigestOutputStream ( sink , md ) ) ; out . writeInt ( INTERFACE_HASH_STUB_VERSION ) ; for ( Method method : remoteMethods ) { MethodDoc methodDoc = method . methodDoc ( ) ; out . writeUTF ( methodDoc . name ( ) ) ; out . writeUTF ( Util . methodDescriptorOf ( methodDoc ) ) ; ClassDoc exceptions [ ] = methodDoc . thrownExceptions ( ) ; Arrays . sort ( exceptions , new ClassDocComparator ( ) ) ; for ( ClassDoc ex : exceptions ) { out . writeUTF ( Util . binaryNameOf ( ex ) ) ; } } out . flush ( ) ; byte hashArray [ ] = md . digest ( ) ; for ( int i = 0 ; i < Math . min ( 8 , hashArray . length ) ; i ++ ) { hash += ( ( long ) ( hashArray [ i ] & 0xFF ) ) << ( i * 8 ) ; } } catch ( IOException e ) { throw new AssertionError ( e ) ; } catch ( NoSuchAlgorithmException e ) { throw new AssertionError ( e ) ; } return hash ; }
computes the " interface hash " of the stub / skeleton pair for this remote implementation class . this is the 64 - bit value used to enforce compatibility between a stub class and a skeleton class in the jdk 1 . 1 version of the jrmp stub / skeleton protocol . it is calculated using the first 64 bits of an sha digest . the digest is of a stream consisting of the following data : ( int ) stub version number , always 1 for each remote method , in order of operation number : ( utf - 8 ) method name ( utf - 8 ) method descriptor for each declared exception , in alphabetical name order : ( utf - 8 ) name of exception class ( where " utf - 8 " includes a 16 - bit length prefix as written by java . io . dataoutput . writeutf ) .
