当前位置: 首页>>代码示例>>Java>>正文


Java ObjectStreamClass.lookup方法代码示例

本文整理汇总了Java中com.sun.corba.se.impl.io.ObjectStreamClass.lookup方法的典型用法代码示例。如果您正苦于以下问题:Java ObjectStreamClass.lookup方法的具体用法?Java ObjectStreamClass.lookup怎么用?Java ObjectStreamClass.lookup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.corba.se.impl.io.ObjectStreamClass的用法示例。


在下文中一共展示了ObjectStreamClass.lookup方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: outputObject

import com.sun.corba.se.impl.io.ObjectStreamClass; //导入方法依赖的package包/类
private void outputObject(final Object obj) throws IOException{

        currentObject = obj;
        Class currclass = obj.getClass();

        /* Get the Class descriptor for this class,
         * Throw a NotSerializableException if there is none.
         */
        currentClassDesc = ObjectStreamClass.lookup(currclass);
        if (currentClassDesc == null) {
            // XXX I18N, Logging needed.
            throw new NotSerializableException(currclass.getName());
        }

        /* If the object is externalizable,
         * call writeExternal.
         * else do Serializable processing.
         */
        if (currentClassDesc.isExternalizable()) {
            // Write format version
            orbStream.write_octet(streamFormatVersion);

            Externalizable ext = (Externalizable)obj;
            ext.writeExternal(this);

        } else {

            /* The object's classes should be processed from supertype to subtype
             * Push all the clases of the current object onto a stack.
             * Remember the stack pointer where this set of classes is being pushed.
             */
            int stackMark = classDescStack.size();
            try {
                ObjectStreamClass next;
                while ((next = currentClassDesc.getSuperclass()) != null) {
                    classDescStack.push(currentClassDesc);
                    currentClassDesc = next;
                }

                /*
                 * For currentClassDesc and all the pushed class descriptors
                 *    If the class is writing its own data
                 *                set blockData = true; call the class writeObject method
                 *    If not
                 *     invoke either the defaultWriteObject method.
                 */
                do {

                    WriteObjectState oldState = writeObjectState;

                    try {

                        setState(NOT_IN_WRITE_OBJECT);

                        if (currentClassDesc.hasWriteObject()) {
                            invokeObjectWriter(currentClassDesc, obj );
                        } else {
                            defaultWriteObjectDelegate();
                        }
                    } finally {
                        setState(oldState);
                    }

                } while (classDescStack.size() > stackMark &&
                         (currentClassDesc = (ObjectStreamClass)classDescStack.pop()) != null);
            } finally {
                classDescStack.setSize(stackMark);
            }
        }
    }
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:71,代码来源:IIOPOutputStream.java

示例2: outputObject

import com.sun.corba.se.impl.io.ObjectStreamClass; //导入方法依赖的package包/类
private void outputObject(final Object obj) throws IOException{

        currentObject = obj;
        Class currclass = obj.getClass();

        /* Get the Class descriptor for this class,
         * Throw a NotSerializableException if there is none.
         */
        currentClassDesc = ObjectStreamClass.lookup(currclass);
        if (currentClassDesc == null) {
            // XXX I18N, Logging needed.
            throw new NotSerializableException(currclass.getName());
        }

        /* If the object is externalizable,
         * call writeExternal.
         * else do Serializable processing.
         */
        if (currentClassDesc.isExternalizable()) {
            // Write format version
            orbStream.write_octet(streamFormatVersion);

            Externalizable ext = (Externalizable)obj;
            ext.writeExternal(this);

        } else {

            /* The object's classes should be processed from supertype to subtype
             * Push all the clases of the current object onto a stack.
             * Remember the stack pointer where this set of classes is being pushed.
             */
            if (currentClassDesc.forClass().getName().equals("java.lang.String")) {
                    this.writeUTF((String)obj);
                    return;
            }
            int stackMark = classDescStack.size();
            try {
                ObjectStreamClass next;
                while ((next = currentClassDesc.getSuperclass()) != null) {
                    classDescStack.push(currentClassDesc);
                    currentClassDesc = next;
                }

                /*
                 * For currentClassDesc and all the pushed class descriptors
                 *    If the class is writing its own data
                 *                set blockData = true; call the class writeObject method
                 *    If not
                 *     invoke either the defaultWriteObject method.
                 */
                do {

                    WriteObjectState oldState = writeObjectState;

                    try {

                        setState(NOT_IN_WRITE_OBJECT);

                        if (currentClassDesc.hasWriteObject()) {
                            invokeObjectWriter(currentClassDesc, obj );
                        } else {
                            defaultWriteObjectDelegate();
                        }
                    } finally {
                        setState(oldState);
                    }

                } while (classDescStack.size() > stackMark &&
                         (currentClassDesc = (ObjectStreamClass)classDescStack.pop()) != null);
            } finally {
                classDescStack.setSize(stackMark);
            }
        }
    }
 
开发者ID:campolake,项目名称:openjdk9,代码行数:75,代码来源:IIOPOutputStream.java

示例3: outputObject

import com.sun.corba.se.impl.io.ObjectStreamClass; //导入方法依赖的package包/类
private void outputObject(final Object obj) throws IOException{

        currentObject = obj;
        Class currclass = obj.getClass();

        /* Get the Class descriptor for this class,
         * Throw a NotSerializableException if there is none.
         */
        currentClassDesc = ObjectStreamClass.lookup(currclass);
        if (currentClassDesc == null) {
        // XXX I18N, Logging needed.
            throw new NotSerializableException(currclass.getName());
        }

        /* If the object is externalizable,
         * call writeExternal.
         * else do Serializable processing.
         */
        if (currentClassDesc.isExternalizable()) {
        // Write format version
        orbStream.write_octet(streamFormatVersion);

            Externalizable ext = (Externalizable)obj;
            ext.writeExternal(this);
            
        } else {

            /* The object's classes should be processed from supertype to subtype
             * Push all the clases of the current object onto a stack.
             * Remember the stack pointer where this set of classes is being pushed.
             */
            int stackMark = classDescStack.size();
            try {
            ObjectStreamClass next;
            while ((next = currentClassDesc.getSuperclass()) != null) {
                classDescStack.push(currentClassDesc);
                currentClassDesc = next;
            }

            /*
             * For currentClassDesc and all the pushed class descriptors
             *    If the class is writing its own data
             *          set blockData = true; call the class writeObject method
             *    If not
             *     invoke either the defaultWriteObject method.
             */
            do {

                    WriteObjectState oldState = writeObjectState;

                    try {

                        setState(NOT_IN_WRITE_OBJECT);

                        if (currentClassDesc.hasWriteObject()) {
                            invokeObjectWriter(currentClassDesc, obj );
                        } else {
                            defaultWriteObjectDelegate();
                        }
                    } finally {
                        setState(oldState);
                    }

            } while (classDescStack.size() > stackMark &&
                 (currentClassDesc = (ObjectStreamClass)classDescStack.pop()) != null);
            } finally {
        classDescStack.setSize(stackMark);
            }
        }
    }
 
开发者ID:kinneerc,项目名称:giv-planner,代码行数:71,代码来源:Test76.java


注:本文中的com.sun.corba.se.impl.io.ObjectStreamClass.lookup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。