/** * Terminate the encapsulation by writing its length * to its beginning. */ public final void endEncapsulation() { if( encaps_start == -1 ) { throw new MARSHAL("Too many end-of-encapsulations"); } if( encaps_stack == null ) { throw new MARSHAL("Internal Error - closeEncapsulation failed"); } // determine the size of this encapsulation int encaps_size = pos - encaps_start; // insert the size integer into the appropriate place buffer[encaps_start -4 ] = (byte)((encaps_size >>> 24) & 0xFF); buffer[encaps_start -3 ] = (byte)((encaps_size >>> 16) & 0xFF); buffer[encaps_start -2 ] = (byte)((encaps_size >>> 8) & 0xFF); buffer[encaps_start -1 ] = (byte)(encaps_size & 0xFF); /* restore index and encaps_start information and indirection maps */ EncapsInfo ei = getEncapsStack().pop(); encaps_start = ei.start; index = ei.index + encaps_size; valueMap = ei.valueMap; repIdMap = ei.repIdMap; codebaseMap = ei.codebaseMap; }