private void writeExternalPKey ( ObjectOutput out ) throws java . io . IOException { // write the serialized primary key - can't mix eternaized stream // and writeObject so convert to bytes... ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; ObjectOutputStream pkeyStream = new ObjectOutputStream ( baos ) ; pkeyStream . writeObject ( pkey ) ; pkeyStream . flush ( ) ; pkeyStream . close ( ) ; byte [ ] pkeyBytes = baos . toByteArray ( ) ; out . writeInt ( pkeyBytes . length ) ; out . write ( pkeyBytes ) ; }
Private helper method for writeExternal - writes the primary key