public int endObject(){
  if (vtable == null || !nested)   throw new AssertionError("FlatBuffers: endObject called without startObject");
  addInt(0);
  int vtableloc=offset();
  for (int i=vtable_in_use - 1; i >= 0; i--) {
    short off=(short)(vtable[i] != 0 ? vtableloc - vtable[i] : 0);
    addShort(off);
  }
  final int standard_fields=2;
  addShort((short)(vtableloc - object_start));
  addShort((short)((vtable_in_use + standard_fields) * SIZEOF_SHORT));
  int existing_vtable=0;
  outer_loop:   for (int i=0; i < num_vtables; i++) {
    int vt1=bb.capacity() - vtables[i];
    int vt2=space;
    short len=bb.getShort(vt1);
    if (len == bb.getShort(vt2)) {
      for (int j=SIZEOF_SHORT; j < len; j+=SIZEOF_SHORT) {
        if (bb.getShort(vt1 + j) != bb.getShort(vt2 + j)) {
          continue outer_loop;
        }
      }
      existing_vtable=vtables[i];
      break outer_loop;
    }
  }
  if (existing_vtable != 0) {
    space=bb.capacity() - vtableloc;
    bb.putInt(space,existing_vtable - vtableloc);
  }
 else {
    if (num_vtables == vtables.length)     vtables=Arrays.copyOf(vtables,num_vtables * 2);
    vtables[num_vtables++]=offset();
    bb.putInt(bb.capacity() - vtableloc,offset() - vtableloc);
  }
  nested=false;
  return vtableloc;
}

public int endObject ( ) { if ( vtable == null || ! nested ) throw new AssertionError ( "FlatBuffers: endObject called without startObject" ) ; addInt ( 0 ) ; int vtableloc = offset ( ) ; for ( int i = vtable_in_use - 1 ; i >= 0 ; i -- ) { short off = ( short ) ( vtable [ i ] != 0 ? vtableloc - vtable [ i ] : 0 ) ; addShort ( off ) ; } final int standard_fields = 2 ; addShort ( ( short ) ( vtableloc - object_start ) ) ; addShort ( ( short ) ( ( vtable_in_use + standard_fields ) * SIZEOF_SHORT ) ) ; int existing_vtable = 0 ; outer_loop : for ( int i = 0 ; i < num_vtables ; i ++ ) { int vt1 = bb . capacity ( ) - vtables [ i ] ; int vt2 = space ; short len = bb . getShort ( vt1 ) ; if ( len == bb . getShort ( vt2 ) ) { for ( int j = SIZEOF_SHORT ; j < len ; j += SIZEOF_SHORT ) { if ( bb . getShort ( vt1 + j ) != bb . getShort ( vt2 + j ) ) { continue outer_loop ; } } existing_vtable = vtables [ i ] ; break outer_loop ; } } if ( existing_vtable != 0 ) { space = bb . capacity ( ) - vtableloc ; bb . putInt ( space , existing_vtable - vtableloc ) ; } else { if ( num_vtables == vtables . length ) vtables = Arrays . copyOf ( vtables , num_vtables * 2 ) ; vtables [ num_vtables ++ ] = offset ( ) ; bb . putInt ( bb . capacity ( ) - vtableloc , offset ( ) - vtableloc ) ; } nested = false ; return vtableloc ; }
finish off writing the object that is under construction .
