FileDocCategorySizeDatePackage
CDRInputObject.javaAPI DocJava SE 5 API7743Fri Aug 26 14:54:20 BST 2005com.sun.corba.se.impl.encoding

CDRInputObject

public class CDRInputObject extends com.sun.corba.se.impl.encoding.CDRInputStream implements com.sun.corba.se.pept.encoding.InputObject
author
Harold Carr

Fields Summary
private com.sun.corba.se.spi.transport.CorbaConnection
corbaConnection
private com.sun.corba.se.impl.protocol.giopmsgheaders.Message
header
private boolean
unmarshaledHeader
private com.sun.corba.se.spi.orb.ORB
orb
private com.sun.corba.se.impl.logging.ORBUtilSystemException
wrapper
private com.sun.corba.se.impl.logging.OMGSystemException
omgWrapper
Constructors Summary
public CDRInputObject(com.sun.corba.se.spi.orb.ORB orb, com.sun.corba.se.spi.transport.CorbaConnection corbaConnection, ByteBuffer byteBuffer, com.sun.corba.se.impl.protocol.giopmsgheaders.Message header)

        super(orb, byteBuffer, header.getSize(), header.isLittleEndian(),
              header.getGIOPVersion(), header.getEncodingVersion(),
              BufferManagerFactory.newBufferManagerRead(
					  header.getGIOPVersion(),
					  header.getEncodingVersion(),
					  orb));

	this.corbaConnection = corbaConnection;
	this.orb = orb ;
	this.wrapper = ORBUtilSystemException.get( orb, 
	    CORBALogDomains.RPC_ENCODING ) ;
	this.omgWrapper = OMGSystemException.get( orb, 
	    CORBALogDomains.RPC_ENCODING ) ;

	if (orb.transportDebugFlag) {
	    dprint(".CDRInputObject constructor:");
	}

        getBufferManager().init(header);

        this.header = header;

        unmarshaledHeader = false;

        setIndex(Message.GIOPMessageHeaderLength);

        setBufferLength(header.getSize());
    
Methods Summary
protected CodeSetConversion.BTCConvertercreateCharBTCConverter()
Override the default CDR factory behavior to get the negotiated code sets from the connection. These are only called once per message, the first time needed. In the local case, there is no Connection, so use the local code sets.

        CodeSetComponentInfo.CodeSetContext codesets = getCodeSets();

        // If the connection doesn't have its negotiated
        // code sets by now, fall back on the defaults defined
        // in CDRInputStream.
        if (codesets == null)
            return super.createCharBTCConverter();
        
        OSFCodeSetRegistry.Entry charSet
            = OSFCodeSetRegistry.lookupEntry(codesets.getCharCodeSet());

        if (charSet == null)
	    throw wrapper.unknownCodeset( charSet ) ;

        return CodeSetConversion.impl().getBTCConverter(charSet, isLittleEndian());
    
protected CodeSetConversion.BTCConvertercreateWCharBTCConverter()


        CodeSetComponentInfo.CodeSetContext codesets = getCodeSets();

        // If the connection doesn't have its negotiated
        // code sets by now, we have to throw an exception.
        // See CORBA formal 00-11-03 13.9.2.6.
        if (codesets == null) {
            if (getConnection().isServer())
		throw omgWrapper.noClientWcharCodesetCtx() ;
            else
		throw omgWrapper.noServerWcharCodesetCmp() ;
        }

        OSFCodeSetRegistry.Entry wcharSet
            = OSFCodeSetRegistry.lookupEntry(codesets.getWCharCodeSet());

        if (wcharSet == null)
	    throw wrapper.unknownCodeset( wcharSet ) ;

        // For GIOP 1.2 and UTF-16, use big endian if there is no byte
        // order marker.  (See issue 3405b)
        //
        // For GIOP 1.1 and UTF-16, use the byte order the stream if
        // there isn't (and there shouldn't be) a byte order marker.
        //
        // GIOP 1.0 doesn't have wchars.  If we're talking to a legacy ORB,
        // we do what our old ORBs did.
        if (wcharSet == OSFCodeSetRegistry.UTF_16) {
            if (getGIOPVersion().equals(GIOPVersion.V1_2))
                return CodeSetConversion.impl().getBTCConverter(wcharSet, false);
        }

        return CodeSetConversion.impl().getBTCConverter(wcharSet, isLittleEndian());
    
protected voiddprint(java.lang.String msg)

	ORBUtility.dprint("CDRInputObject", msg);
    
public com.sun.corba.se.impl.encoding.CDRInputStreamdup()

        // XREVISIT
        return null;
        // return new XIIOPInputStream(this);
    
public final com.sun.org.omg.SendingContext.CodeBasegetCodeBase()

        if (getConnection() == null)
            return null;
        else
            return getConnection().getCodeBase();
    
private CodeSetComponentInfo.CodeSetContextgetCodeSets()

        if (getConnection() == null)
            return CodeSetComponentInfo.LOCAL_CODE_SETS;
        else
            return getConnection().getCodeSetContext();
    
public final com.sun.corba.se.spi.transport.CorbaConnectiongetConnection()

        return corbaConnection;
    
public com.sun.corba.se.impl.protocol.giopmsgheaders.MessagegetMessageHeader()

        return header;
    
public voidunmarshalHeader()
Unmarshal the extended GIOP header NOTE: May be fragmented, so should not be called by the ReaderThread. See CorbaResponseWaitingRoomImpl.waitForResponse. It is done there in the client thread.

        // Unmarshal the extended GIOP message from the buffer.

        if (!unmarshaledHeader) {
	    try {
		if (((ORB)orb()).transportDebugFlag) {
		    dprint(".unmarshalHeader->: " + getMessageHeader());
		}
		getMessageHeader().read(this);
		unmarshaledHeader= true;
	    } catch (RuntimeException e) {
		if (((ORB)orb()).transportDebugFlag) {
		    dprint(".unmarshalHeader: !!ERROR!!: " 
			   + getMessageHeader()
			   + ": " + e);
		}
		throw e;
	    } finally {
		if (((ORB)orb()).transportDebugFlag) {
		    dprint(".unmarshalHeader<-: " + getMessageHeader());
		}
	    }
        }
    
public final booleanunmarshaledHeader()

        return unmarshaledHeader;