if (_kind == TCKind._tk_native)
throw wrapper.cannotMarshalNative() ;
// We have to remember the stream and position for EVERY type code
// in case some recursive or indirect type code references it.
TypeCodeReader topStream = tcis.getTopLevelStream();
if (_kind == tk_indirect) {
int streamOffset = tcis.read_long();
if (streamOffset > -4)
throw wrapper.invalidIndirection( new Integer(streamOffset) ) ;
// The encoding used for indirection is the same as that used for recursive ,
// TypeCodes i.e., a 0xffffffff indirection marker followed by a long offset
// (in units of octets) from the beginning of the long offset.
int topPos = tcis.getTopLevelPosition();
// substract 4 to get back to the beginning of the long offset.
int indirectTypePosition = topPos - 4 + streamOffset;
// Now we have to find the referenced type
// by its indirectTypePosition within topStream.
//if (debug) System.out.println(
// "TypeCodeImpl looking up indirection at position topPos " +
//topPos + " - 4 + offset " + streamOffset + " = " + indirectTypePosition);
TypeCodeImpl type = topStream.getTypeCodeAtPosition(indirectTypePosition);
if (type == null)
throw wrapper.indirectionNotFound( new Integer(indirectTypePosition) ) ;
setIndirectType(type);
return false;
}
topStream.addTypeCodeAtPosition(this, myPosition);
return true;
}