Examples of PrimitiveArrayInstance


Examples of org.netbeans.lib.profiler.heap.PrimitiveArrayInstance

        int offset = 0;
        int len = -1;
        for(FieldValue f: obj.getFieldValues()) {
            Field ff = f.getField();
            if ("value".equals(ff.getName())) {
                PrimitiveArrayInstance chars = (PrimitiveArrayInstance) ((ObjectFieldValue)f).getInstance();
                text = new char[chars.getLength()];
                for(int i = 0; i != text.length; ++i) {
                    text[i] = ((String)chars.getValues().get(i)).charAt(0);
                }
            }
            // fields below were removed in Java 7
            else if ("offset".equals(ff.getName())) {
                offset = Integer.valueOf(f.getValue());
View Full Code Here

Examples of org.netbeans.lib.profiler.heap.PrimitiveArrayInstance

    public static <T> T primitiveArrayValue(Instance obj) {
        if (obj == null) {
            return null;
        }
        if (obj instanceof PrimitiveArrayInstance) {
            PrimitiveArrayInstance pa = (PrimitiveArrayInstance) obj;
            String type = pa.getJavaClass().getName();
            Object array;
            int len = pa.getLength();
            if ("boolean[]".equals(type)) {
                array = new boolean[len];
            }
            else if ("byte[]".equals(type)) {
                array = new byte[len];
            }
            else if ("char[]".equals(type)) {
                array = new char[len];
            }
            else if ("short[]".equals(type)) {
                array = new short[len];
            }
            else if ("int[]".equals(type)) {
                array = new int[len];
            }
            else if ("long[]".equals(type)) {
                array = new long[len];
            }
            else if ("float[]".equals(type)) {
                array = new float[len];
            }
            else if ("double[]".equals(type)) {
                array = new double[len];
            }
            else {
                throw new IllegalArgumentException("Is not a primitive array: " + obj.getInstanceId() + " (" + obj.getJavaClass().getName() + ")");
            }

            List<Object> values = pa.getValues();
            for(int i = 0; i != values.size(); ++i) {
                Object val = values.get(i);
                if (val instanceof String) {
                    val = Character.valueOf(((String)val).charAt(0));
                }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.