Char Array Example

The following information pertains to marshalling three dimensional arrays of char, (i.e. char[][][]). Single dimensional char arrays are converted into String arrays, and then marshalled as normal. Larger dimensions (2D, 3D, 4D and 5D) are converted into a String array with one less dimension, and then marshalled. Larger dimensions are not supported, and will marshal as a message indicating that fact.

Sample Code

        public void test3DCharArray() throws Exception {
                Marshaller marshaller = new Marshaller(
                                Marshaller.FQCN_NEVER, Marshaller.SHOW_ACTUAL_TYPE);

                char[] object11 = "abc".toCharArray();
                char[] object21 = "def".toCharArray();
                char[] object31 = "ghi".toCharArray();
                char[][] object1 = { object11, object21, object31 };

                char[] object12 = "abc".toCharArray();
                char[] object22 = "def".toCharArray();
                char[] object32 = "ghi".toCharArray();
                char[][] object2 = { object12, object22, object32 };

                char[][][] object = { object1, object2 };

                Map map = marshaller.marshal(object);

                BufferedWriter bw = new BufferedWriter(new FileWriter("c:\\temp\\"));

FreeMind MindMap Representation