1 7 8 package com.sun.corba.se.impl.ior; 9 10 import java.util.Arrays ; 11 import com.sun.corba.se.spi.ior.ObjectId ; 12 import org.omg.CORBA_2_3.portable.OutputStream ; 13 14 17 public final class ObjectIdImpl implements ObjectId 18 { 19 private byte[] id; 20 21 public boolean equals( Object obj ) 22 { 23 if (!(obj instanceof ObjectIdImpl)) 24 return false ; 25 26 ObjectIdImpl other = (ObjectIdImpl)obj ; 27 28 return Arrays.equals( this.id, other.id ) ; 29 } 30 31 public int hashCode() 32 { 33 int result = 17 ; 34 for (int ctr=0; ctr<id.length; ctr++) 35 result = 37*result + id[ctr] ; 36 return result ; 37 } 38 39 public ObjectIdImpl( byte[] id ) 40 { 41 this.id = id ; 42 } 43 44 public byte[] getId() 45 { 46 return id ; 47 } 48 49 public void write( OutputStream os ) 50 { 51 os.write_long( id.length ) ; 52 os.write_octet_array( id, 0, id.length ) ; 53 } 54 } 55 | Popular Tags |