Java Code Examples for javax.rmi.CORBA.ValueHandlerMultiFormat#writeValue()

The following examples show how to use javax.rmi.CORBA.ValueHandlerMultiFormat#writeValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CDROutputStream_1_0.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
private void writeArray(Serializable array, Class clazz) {

        if (valueHandler == null)
            valueHandler = ORBUtility.createValueHandler(); //d11638

        // Write value_tag
        int indirection = writeValueTag(mustChunk, true,
                                        Util.getCodebase(clazz));

        // Write repository ID
        write_repositoryId(repIdStrs.createSequenceRepID(clazz));

        // Add indirection for object to indirection table
        updateIndirectionTable(indirection, array, array);

        // Write Value chunk
        if (mustChunk) {
            start_block();
            end_flag--;
            chunkedValueNestingLevel--;
        } else
            end_flag--;

        if (valueHandler instanceof ValueHandlerMultiFormat) {
            ValueHandlerMultiFormat vh = (ValueHandlerMultiFormat)valueHandler;
            vh.writeValue(parent, array, streamFormatVersion);
        } else
            valueHandler.writeValue(parent, array);

        if (mustChunk)
            end_block();

        // Write end tag
        writeEndTag(mustChunk);
    }
 
Example 2
Source File: CDROutputStream_1_0.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private void writeArray(Serializable array, Class clazz) {

        if (valueHandler == null)
            valueHandler = ORBUtility.createValueHandler(); //d11638

        // Write value_tag
        int indirection = writeValueTag(mustChunk, true,
                                        Util.getCodebase(clazz));

        // Write repository ID
        write_repositoryId(repIdStrs.createSequenceRepID(clazz));

        // Add indirection for object to indirection table
        updateIndirectionTable(indirection, array, array);

        // Write Value chunk
        if (mustChunk) {
            start_block();
            end_flag--;
            chunkedValueNestingLevel--;
        } else
            end_flag--;

        if (valueHandler instanceof ValueHandlerMultiFormat) {
            ValueHandlerMultiFormat vh = (ValueHandlerMultiFormat)valueHandler;
            vh.writeValue(parent, array, streamFormatVersion);
        } else
            valueHandler.writeValue(parent, array);

        if (mustChunk)
            end_block();

        // Write end tag
        writeEndTag(mustChunk);
    }
 
Example 3
Source File: CDROutputStream_1_0.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private void writeArray(Serializable array, Class clazz) {

        if (valueHandler == null)
            valueHandler = ORBUtility.createValueHandler(); //d11638

        // Write value_tag
        int indirection = writeValueTag(mustChunk, true,
                                        Util.getCodebase(clazz));

        // Write repository ID
        write_repositoryId(repIdStrs.createSequenceRepID(clazz));

        // Add indirection for object to indirection table
        updateIndirectionTable(indirection, array, array);

        // Write Value chunk
        if (mustChunk) {
            start_block();
            end_flag--;
            chunkedValueNestingLevel--;
        } else
            end_flag--;

        if (valueHandler instanceof ValueHandlerMultiFormat) {
            ValueHandlerMultiFormat vh = (ValueHandlerMultiFormat)valueHandler;
            vh.writeValue(parent, array, streamFormatVersion);
        } else
            valueHandler.writeValue(parent, array);

        if (mustChunk)
            end_block();

        // Write end tag
        writeEndTag(mustChunk);
    }
 
Example 4
Source File: CDROutputStream_1_0.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private void writeArray(Serializable array, Class clazz) {

        if (valueHandler == null)
            valueHandler = ORBUtility.createValueHandler(); //d11638

        // Write value_tag
        int indirection = writeValueTag(mustChunk, true,
                                        Util.getCodebase(clazz));

        // Write repository ID
        write_repositoryId(repIdStrs.createSequenceRepID(clazz));

        // Add indirection for object to indirection table
        updateIndirectionTable(indirection, array, array);

        // Write Value chunk
        if (mustChunk) {
            start_block();
            end_flag--;
            chunkedValueNestingLevel--;
        } else
            end_flag--;

        if (valueHandler instanceof ValueHandlerMultiFormat) {
            ValueHandlerMultiFormat vh = (ValueHandlerMultiFormat)valueHandler;
            vh.writeValue(parent, array, streamFormatVersion);
        } else
            valueHandler.writeValue(parent, array);

        if (mustChunk)
            end_block();

        // Write end tag
        writeEndTag(mustChunk);
    }
 
Example 5
Source File: CDROutputStream_1_0.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
private void writeArray(Serializable array, Class clazz) {

        if (valueHandler == null)
            valueHandler = ORBUtility.createValueHandler(); //d11638

        // Write value_tag
        int indirection = writeValueTag(mustChunk, true,
                                        Util.getCodebase(clazz));

        // Write repository ID
        write_repositoryId(repIdStrs.createSequenceRepID(clazz));

        // Add indirection for object to indirection table
        updateIndirectionTable(indirection, array, array);

        // Write Value chunk
        if (mustChunk) {
            start_block();
            end_flag--;
            chunkedValueNestingLevel--;
        } else
            end_flag--;

        if (valueHandler instanceof ValueHandlerMultiFormat) {
            ValueHandlerMultiFormat vh = (ValueHandlerMultiFormat)valueHandler;
            vh.writeValue(parent, array, streamFormatVersion);
        } else
            valueHandler.writeValue(parent, array);

        if (mustChunk)
            end_block();

        // Write end tag
        writeEndTag(mustChunk);
    }
 
Example 6
Source File: CDROutputStream_1_0.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private void writeArray(Serializable array, Class clazz) {

        if (valueHandler == null)
            valueHandler = ORBUtility.createValueHandler(); //d11638

        // Write value_tag
        int indirection = writeValueTag(mustChunk, true,
                                        Util.getCodebase(clazz));

        // Write repository ID
        write_repositoryId(repIdStrs.createSequenceRepID(clazz));

        // Add indirection for object to indirection table
        updateIndirectionTable(indirection, array, array);

        // Write Value chunk
        if (mustChunk) {
            start_block();
            end_flag--;
            chunkedValueNestingLevel--;
        } else
            end_flag--;

        if (valueHandler instanceof ValueHandlerMultiFormat) {
            ValueHandlerMultiFormat vh = (ValueHandlerMultiFormat)valueHandler;
            vh.writeValue(parent, array, streamFormatVersion);
        } else
            valueHandler.writeValue(parent, array);

        if (mustChunk)
            end_block();

        // Write end tag
        writeEndTag(mustChunk);
    }
 
Example 7
Source File: CDROutputStream_1_0.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private void writeArray(Serializable array, Class clazz) {

        if (valueHandler == null)
            valueHandler = ORBUtility.createValueHandler(); //d11638

        // Write value_tag
        int indirection = writeValueTag(mustChunk, true,
                                        Util.getCodebase(clazz));

        // Write repository ID
        write_repositoryId(repIdStrs.createSequenceRepID(clazz));

        // Add indirection for object to indirection table
        updateIndirectionTable(indirection, array, array);

        // Write Value chunk
        if (mustChunk) {
            start_block();
            end_flag--;
            chunkedValueNestingLevel--;
        } else
            end_flag--;

        if (valueHandler instanceof ValueHandlerMultiFormat) {
            ValueHandlerMultiFormat vh = (ValueHandlerMultiFormat)valueHandler;
            vh.writeValue(parent, array, streamFormatVersion);
        } else
            valueHandler.writeValue(parent, array);

        if (mustChunk)
            end_block();

        // Write end tag
        writeEndTag(mustChunk);
    }
 
Example 8
Source File: CDROutputStream_1_0.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private void writeArray(Serializable array, Class clazz) {

        if (valueHandler == null)
            valueHandler = ORBUtility.createValueHandler(); //d11638

        // Write value_tag
        int indirection = writeValueTag(mustChunk, true,
                                        Util.getCodebase(clazz));

        // Write repository ID
        write_repositoryId(repIdStrs.createSequenceRepID(clazz));

        // Add indirection for object to indirection table
        updateIndirectionTable(indirection, array, array);

        // Write Value chunk
        if (mustChunk) {
            start_block();
            end_flag--;
            chunkedValueNestingLevel--;
        } else
            end_flag--;

        if (valueHandler instanceof ValueHandlerMultiFormat) {
            ValueHandlerMultiFormat vh = (ValueHandlerMultiFormat)valueHandler;
            vh.writeValue(parent, array, streamFormatVersion);
        } else
            valueHandler.writeValue(parent, array);

        if (mustChunk)
            end_block();

        // Write end tag
        writeEndTag(mustChunk);
    }
 
Example 9
Source File: CDROutputStream_1_0.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private void writeArray(Serializable array, Class clazz) {

        if (valueHandler == null)
            valueHandler = ORBUtility.createValueHandler(); //d11638

        // Write value_tag
        int indirection = writeValueTag(mustChunk, true,
                                        Util.getCodebase(clazz));

        // Write repository ID
        write_repositoryId(repIdStrs.createSequenceRepID(clazz));

        // Add indirection for object to indirection table
        updateIndirectionTable(indirection, array, array);

        // Write Value chunk
        if (mustChunk) {
            start_block();
            end_flag--;
            chunkedValueNestingLevel--;
        } else
            end_flag--;

        if (valueHandler instanceof ValueHandlerMultiFormat) {
            ValueHandlerMultiFormat vh = (ValueHandlerMultiFormat)valueHandler;
            vh.writeValue(parent, array, streamFormatVersion);
        } else
            valueHandler.writeValue(parent, array);

        if (mustChunk)
            end_block();

        // Write end tag
        writeEndTag(mustChunk);
    }
 
Example 10
Source File: CDROutputStream_1_0.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void writeArray(Serializable array, Class clazz) {

        if (valueHandler == null)
            valueHandler = ORBUtility.createValueHandler(); //d11638

        // Write value_tag
        int indirection = writeValueTag(mustChunk, true,
                                        Util.getCodebase(clazz));

        // Write repository ID
        write_repositoryId(repIdStrs.createSequenceRepID(clazz));

        // Add indirection for object to indirection table
        updateIndirectionTable(indirection, array, array);

        // Write Value chunk
        if (mustChunk) {
            start_block();
            end_flag--;
            chunkedValueNestingLevel--;
        } else
            end_flag--;

        if (valueHandler instanceof ValueHandlerMultiFormat) {
            ValueHandlerMultiFormat vh = (ValueHandlerMultiFormat)valueHandler;
            vh.writeValue(parent, array, streamFormatVersion);
        } else
            valueHandler.writeValue(parent, array);

        if (mustChunk)
            end_block();

        // Write end tag
        writeEndTag(mustChunk);
    }
 
Example 11
Source File: CDROutputStream_1_0.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
private void writeRMIIIOPValueType(Serializable object, Class clazz) {
    if (valueHandler == null)
        valueHandler = ORBUtility.createValueHandler(); //d11638

    Serializable key = object;

    // Allow the ValueHandler to call writeReplace on
    // the Serializable (if the method is present)
    object = valueHandler.writeReplace(key);

    if (object == null) {
        // Write null tag and return
        write_long(0);
        return;
    }

    if (object != key) {
        if (valueCache != null && valueCache.containsKey(object)) {
            writeIndirection(INDIRECTION_TAG, valueCache.getVal(object));
            return;
        }

        clazz = object.getClass();
    }

    if (mustChunk || valueHandler.isCustomMarshaled(clazz)) {
        mustChunk = true;
    }

    // Write value_tag
    int indirection = writeValueTag(mustChunk, true, Util.getCodebase(clazz));

    // Write rep. id
    write_repositoryId(repIdStrs.createForJavaType(clazz));

    // Add indirection for object to indirection table
    updateIndirectionTable(indirection, object, key);

    if (mustChunk) {
        // Write Value chunk
        end_flag--;
        chunkedValueNestingLevel--;
        start_block();
    } else
        end_flag--;

    if (valueHandler instanceof ValueHandlerMultiFormat) {
        ValueHandlerMultiFormat vh = (ValueHandlerMultiFormat)valueHandler;
        vh.writeValue(parent, object, streamFormatVersion);
    } else
        valueHandler.writeValue(parent, object);

    if (mustChunk)
        end_block();

    // Write end tag
    writeEndTag(mustChunk);
}
 
Example 12
Source File: CDROutputStream_1_0.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
private void writeRMIIIOPValueType(Serializable object, Class clazz) {
    if (valueHandler == null)
        valueHandler = ORBUtility.createValueHandler(); //d11638

    Serializable key = object;

    // Allow the ValueHandler to call writeReplace on
    // the Serializable (if the method is present)
    object = valueHandler.writeReplace(key);

    if (object == null) {
        // Write null tag and return
        write_long(0);
        return;
    }

    if (object != key) {
        if (valueCache != null && valueCache.containsKey(object)) {
            writeIndirection(INDIRECTION_TAG, valueCache.getVal(object));
            return;
        }

        clazz = object.getClass();
    }

    if (mustChunk || valueHandler.isCustomMarshaled(clazz)) {
        mustChunk = true;
    }

    // Write value_tag
    int indirection = writeValueTag(mustChunk, true, Util.getCodebase(clazz));

    // Write rep. id
    write_repositoryId(repIdStrs.createForJavaType(clazz));

    // Add indirection for object to indirection table
    updateIndirectionTable(indirection, object, key);

    if (mustChunk) {
        // Write Value chunk
        end_flag--;
        chunkedValueNestingLevel--;
        start_block();
    } else
        end_flag--;

    if (valueHandler instanceof ValueHandlerMultiFormat) {
        ValueHandlerMultiFormat vh = (ValueHandlerMultiFormat)valueHandler;
        vh.writeValue(parent, object, streamFormatVersion);
    } else
        valueHandler.writeValue(parent, object);

    if (mustChunk)
        end_block();

    // Write end tag
    writeEndTag(mustChunk);
}
 
Example 13
Source File: CDROutputStream_1_0.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
private void writeRMIIIOPValueType(Serializable object, Class clazz) {
    if (valueHandler == null)
        valueHandler = ORBUtility.createValueHandler(); //d11638

    Serializable key = object;

    // Allow the ValueHandler to call writeReplace on
    // the Serializable (if the method is present)
    object = valueHandler.writeReplace(key);

    if (object == null) {
        // Write null tag and return
        write_long(0);
        return;
    }

    if (object != key) {
        if (valueCache != null && valueCache.containsKey(object)) {
            writeIndirection(INDIRECTION_TAG, valueCache.getVal(object));
            return;
        }

        clazz = object.getClass();
    }

    if (mustChunk || valueHandler.isCustomMarshaled(clazz)) {
        mustChunk = true;
    }

    // Write value_tag
    int indirection = writeValueTag(mustChunk, true, Util.getCodebase(clazz));

    // Write rep. id
    write_repositoryId(repIdStrs.createForJavaType(clazz));

    // Add indirection for object to indirection table
    updateIndirectionTable(indirection, object, key);

    if (mustChunk) {
        // Write Value chunk
        end_flag--;
        chunkedValueNestingLevel--;
        start_block();
    } else
        end_flag--;

    if (valueHandler instanceof ValueHandlerMultiFormat) {
        ValueHandlerMultiFormat vh = (ValueHandlerMultiFormat)valueHandler;
        vh.writeValue(parent, object, streamFormatVersion);
    } else
        valueHandler.writeValue(parent, object);

    if (mustChunk)
        end_block();

    // Write end tag
    writeEndTag(mustChunk);
}
 
Example 14
Source File: CDROutputStream_1_0.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private void writeRMIIIOPValueType(Serializable object, Class clazz) {
    if (valueHandler == null)
        valueHandler = ORBUtility.createValueHandler(); //d11638

    Serializable key = object;

    // Allow the ValueHandler to call writeReplace on
    // the Serializable (if the method is present)
    object = valueHandler.writeReplace(key);

    if (object == null) {
        // Write null tag and return
        write_long(0);
        return;
    }

    if (object != key) {
        if (valueCache != null && valueCache.containsKey(object)) {
            writeIndirection(INDIRECTION_TAG, valueCache.getVal(object));
            return;
        }

        clazz = object.getClass();
    }

    if (mustChunk || valueHandler.isCustomMarshaled(clazz)) {
        mustChunk = true;
    }

    // Write value_tag
    int indirection = writeValueTag(mustChunk, true, Util.getCodebase(clazz));

    // Write rep. id
    write_repositoryId(repIdStrs.createForJavaType(clazz));

    // Add indirection for object to indirection table
    updateIndirectionTable(indirection, object, key);

    if (mustChunk) {
        // Write Value chunk
        end_flag--;
        chunkedValueNestingLevel--;
        start_block();
    } else
        end_flag--;

    if (valueHandler instanceof ValueHandlerMultiFormat) {
        ValueHandlerMultiFormat vh = (ValueHandlerMultiFormat)valueHandler;
        vh.writeValue(parent, object, streamFormatVersion);
    } else
        valueHandler.writeValue(parent, object);

    if (mustChunk)
        end_block();

    // Write end tag
    writeEndTag(mustChunk);
}
 
Example 15
Source File: CDROutputStream_1_0.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
private void writeRMIIIOPValueType(Serializable object, Class clazz) {
    if (valueHandler == null)
        valueHandler = ORBUtility.createValueHandler(); //d11638

    Serializable key = object;

    // Allow the ValueHandler to call writeReplace on
    // the Serializable (if the method is present)
    object = valueHandler.writeReplace(key);

    if (object == null) {
        // Write null tag and return
        write_long(0);
        return;
    }

    if (object != key) {
        if (valueCache != null && valueCache.containsKey(object)) {
            writeIndirection(INDIRECTION_TAG, valueCache.getVal(object));
            return;
        }

        clazz = object.getClass();
    }

    if (mustChunk || valueHandler.isCustomMarshaled(clazz)) {
        mustChunk = true;
    }

    // Write value_tag
    int indirection = writeValueTag(mustChunk, true, Util.getCodebase(clazz));

    // Write rep. id
    write_repositoryId(repIdStrs.createForJavaType(clazz));

    // Add indirection for object to indirection table
    updateIndirectionTable(indirection, object, key);

    if (mustChunk) {
        // Write Value chunk
        end_flag--;
        chunkedValueNestingLevel--;
        start_block();
    } else
        end_flag--;

    if (valueHandler instanceof ValueHandlerMultiFormat) {
        ValueHandlerMultiFormat vh = (ValueHandlerMultiFormat)valueHandler;
        vh.writeValue(parent, object, streamFormatVersion);
    } else
        valueHandler.writeValue(parent, object);

    if (mustChunk)
        end_block();

    // Write end tag
    writeEndTag(mustChunk);
}
 
Example 16
Source File: CDROutputStream_1_0.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
private void writeRMIIIOPValueType(Serializable object, Class clazz) {
    if (valueHandler == null)
        valueHandler = ORBUtility.createValueHandler(); //d11638

    Serializable key = object;

    // Allow the ValueHandler to call writeReplace on
    // the Serializable (if the method is present)
    object = valueHandler.writeReplace(key);

    if (object == null) {
        // Write null tag and return
        write_long(0);
        return;
    }

    if (object != key) {
        if (valueCache != null && valueCache.containsKey(object)) {
            writeIndirection(INDIRECTION_TAG, valueCache.getVal(object));
            return;
        }

        clazz = object.getClass();
    }

    if (mustChunk || valueHandler.isCustomMarshaled(clazz)) {
        mustChunk = true;
    }

    // Write value_tag
    int indirection = writeValueTag(mustChunk, true, Util.getCodebase(clazz));

    // Write rep. id
    write_repositoryId(repIdStrs.createForJavaType(clazz));

    // Add indirection for object to indirection table
    updateIndirectionTable(indirection, object, key);

    if (mustChunk) {
        // Write Value chunk
        end_flag--;
        chunkedValueNestingLevel--;
        start_block();
    } else
        end_flag--;

    if (valueHandler instanceof ValueHandlerMultiFormat) {
        ValueHandlerMultiFormat vh = (ValueHandlerMultiFormat)valueHandler;
        vh.writeValue(parent, object, streamFormatVersion);
    } else
        valueHandler.writeValue(parent, object);

    if (mustChunk)
        end_block();

    // Write end tag
    writeEndTag(mustChunk);
}
 
Example 17
Source File: CDROutputStream_1_0.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
private void writeRMIIIOPValueType(Serializable object, Class clazz) {
    if (valueHandler == null)
        valueHandler = ORBUtility.createValueHandler(); //d11638

    Serializable key = object;

    // Allow the ValueHandler to call writeReplace on
    // the Serializable (if the method is present)
    object = valueHandler.writeReplace(key);

    if (object == null) {
        // Write null tag and return
        write_long(0);
        return;
    }

    if (object != key) {
        if (valueCache != null && valueCache.containsKey(object)) {
            writeIndirection(INDIRECTION_TAG, valueCache.getVal(object));
            return;
        }

        clazz = object.getClass();
    }

    if (mustChunk || valueHandler.isCustomMarshaled(clazz)) {
        mustChunk = true;
    }

    // Write value_tag
    int indirection = writeValueTag(mustChunk, true, Util.getCodebase(clazz));

    // Write rep. id
    write_repositoryId(repIdStrs.createForJavaType(clazz));

    // Add indirection for object to indirection table
    updateIndirectionTable(indirection, object, key);

    if (mustChunk) {
        // Write Value chunk
        end_flag--;
        chunkedValueNestingLevel--;
        start_block();
    } else
        end_flag--;

    if (valueHandler instanceof ValueHandlerMultiFormat) {
        ValueHandlerMultiFormat vh = (ValueHandlerMultiFormat)valueHandler;
        vh.writeValue(parent, object, streamFormatVersion);
    } else
        valueHandler.writeValue(parent, object);

    if (mustChunk)
        end_block();

    // Write end tag
    writeEndTag(mustChunk);
}
 
Example 18
Source File: CDROutputStream_1_0.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
private void writeRMIIIOPValueType(Serializable object, Class clazz) {
    if (valueHandler == null)
        valueHandler = ORBUtility.createValueHandler(); //d11638

    Serializable key = object;

    // Allow the ValueHandler to call writeReplace on
    // the Serializable (if the method is present)
    object = valueHandler.writeReplace(key);

    if (object == null) {
        // Write null tag and return
        write_long(0);
        return;
    }

    if (object != key) {
        if (valueCache != null && valueCache.containsKey(object)) {
            writeIndirection(INDIRECTION_TAG, valueCache.getVal(object));
            return;
        }

        clazz = object.getClass();
    }

    if (mustChunk || valueHandler.isCustomMarshaled(clazz)) {
        mustChunk = true;
    }

    // Write value_tag
    int indirection = writeValueTag(mustChunk, true, Util.getCodebase(clazz));

    // Write rep. id
    write_repositoryId(repIdStrs.createForJavaType(clazz));

    // Add indirection for object to indirection table
    updateIndirectionTable(indirection, object, key);

    if (mustChunk) {
        // Write Value chunk
        end_flag--;
        chunkedValueNestingLevel--;
        start_block();
    } else
        end_flag--;

    if (valueHandler instanceof ValueHandlerMultiFormat) {
        ValueHandlerMultiFormat vh = (ValueHandlerMultiFormat)valueHandler;
        vh.writeValue(parent, object, streamFormatVersion);
    } else
        valueHandler.writeValue(parent, object);

    if (mustChunk)
        end_block();

    // Write end tag
    writeEndTag(mustChunk);
}
 
Example 19
Source File: CDROutputStream_1_0.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
private void writeRMIIIOPValueType(Serializable object, Class clazz) {
    if (valueHandler == null)
        valueHandler = ORBUtility.createValueHandler(); //d11638

    Serializable key = object;

    // Allow the ValueHandler to call writeReplace on
    // the Serializable (if the method is present)
    object = valueHandler.writeReplace(key);

    if (object == null) {
        // Write null tag and return
        write_long(0);
        return;
    }

    if (object != key) {
        if (valueCache != null && valueCache.containsKey(object)) {
            writeIndirection(INDIRECTION_TAG, valueCache.getVal(object));
            return;
        }

        clazz = object.getClass();
    }

    if (mustChunk || valueHandler.isCustomMarshaled(clazz)) {
        mustChunk = true;
    }

    // Write value_tag
    int indirection = writeValueTag(mustChunk, true, Util.getCodebase(clazz));

    // Write rep. id
    write_repositoryId(repIdStrs.createForJavaType(clazz));

    // Add indirection for object to indirection table
    updateIndirectionTable(indirection, object, key);

    if (mustChunk) {
        // Write Value chunk
        end_flag--;
        chunkedValueNestingLevel--;
        start_block();
    } else
        end_flag--;

    if (valueHandler instanceof ValueHandlerMultiFormat) {
        ValueHandlerMultiFormat vh = (ValueHandlerMultiFormat)valueHandler;
        vh.writeValue(parent, object, streamFormatVersion);
    } else
        valueHandler.writeValue(parent, object);

    if (mustChunk)
        end_block();

    // Write end tag
    writeEndTag(mustChunk);
}
 
Example 20
Source File: CDROutputStream_1_0.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
private void writeRMIIIOPValueType(Serializable object, Class clazz) {
    if (valueHandler == null)
        valueHandler = ORBUtility.createValueHandler(); //d11638

    Serializable key = object;

    // Allow the ValueHandler to call writeReplace on
    // the Serializable (if the method is present)
    object = valueHandler.writeReplace(key);

    if (object == null) {
        // Write null tag and return
        write_long(0);
        return;
    }

    if (object != key) {
        if (valueCache != null && valueCache.containsKey(object)) {
            writeIndirection(INDIRECTION_TAG, valueCache.getVal(object));
            return;
        }

        clazz = object.getClass();
    }

    if (mustChunk || valueHandler.isCustomMarshaled(clazz)) {
        mustChunk = true;
    }

    // Write value_tag
    int indirection = writeValueTag(mustChunk, true, Util.getCodebase(clazz));

    // Write rep. id
    write_repositoryId(repIdStrs.createForJavaType(clazz));

    // Add indirection for object to indirection table
    updateIndirectionTable(indirection, object, key);

    if (mustChunk) {
        // Write Value chunk
        end_flag--;
        chunkedValueNestingLevel--;
        start_block();
    } else
        end_flag--;

    if (valueHandler instanceof ValueHandlerMultiFormat) {
        ValueHandlerMultiFormat vh = (ValueHandlerMultiFormat)valueHandler;
        vh.writeValue(parent, object, streamFormatVersion);
    } else
        valueHandler.writeValue(parent, object);

    if (mustChunk)
        end_block();

    // Write end tag
    writeEndTag(mustChunk);
}