17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
59a70fc3bSMark J. Nelson  * Common Development and Distribution License (the "License").
69a70fc3bSMark J. Nelson  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
227c478bd9Sstevel@tonic-gate  * Copyright (c) 1999 by Sun Microsystems, Inc.
237c478bd9Sstevel@tonic-gate  * All rights reserved.
247c478bd9Sstevel@tonic-gate  *
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate //  AttributeDescriptor.java: Describes an SLP attribute.
287c478bd9Sstevel@tonic-gate //  Author:           James Kempf
297c478bd9Sstevel@tonic-gate //  Created On:       Thu Jun 19 10:38:01 1997
307c478bd9Sstevel@tonic-gate //  Last Modified By: James Kempf
317c478bd9Sstevel@tonic-gate //  Last Modified On: Tue Jun  2 13:29:08 1998
327c478bd9Sstevel@tonic-gate //  Update Count:     29
337c478bd9Sstevel@tonic-gate //
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate package com.sun.slp;
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate import java.util.*;
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate /**
41*55fea89dSDan Cross  * The instances of the AttributeDescriptor class
427c478bd9Sstevel@tonic-gate  * return information on a particular service location attribute. This
437c478bd9Sstevel@tonic-gate  * information is primarily for GUI tools. Programmatic attribute
447c478bd9Sstevel@tonic-gate  * verification should be done through the ServiceLocationAttributeVerifier.
457c478bd9Sstevel@tonic-gate  *
467c478bd9Sstevel@tonic-gate  * @author James Kempf
477c478bd9Sstevel@tonic-gate  *
487c478bd9Sstevel@tonic-gate  */
497c478bd9Sstevel@tonic-gate 
507c478bd9Sstevel@tonic-gate class AttributeDescriptor
517c478bd9Sstevel@tonic-gate     extends Object
527c478bd9Sstevel@tonic-gate     implements ServiceLocationAttributeDescriptor {
537c478bd9Sstevel@tonic-gate 
547c478bd9Sstevel@tonic-gate     // Indicates byte array type.
557c478bd9Sstevel@tonic-gate 
567c478bd9Sstevel@tonic-gate     private static final String JAVA_OPAQUE_TYPE = "[B";
577c478bd9Sstevel@tonic-gate 
587c478bd9Sstevel@tonic-gate     private String id = "";
597c478bd9Sstevel@tonic-gate     private String valueType = "";
607c478bd9Sstevel@tonic-gate     private String description = "";
617c478bd9Sstevel@tonic-gate     private Vector allowedValues = new Vector();
627c478bd9Sstevel@tonic-gate     private Vector defaultValues = new Vector();
637c478bd9Sstevel@tonic-gate     private boolean isMultivalued = false;
647c478bd9Sstevel@tonic-gate     private boolean isOptional = false;
657c478bd9Sstevel@tonic-gate     private boolean requiresExplicitMatch = false;
667c478bd9Sstevel@tonic-gate     private boolean isLiteral = false;
677c478bd9Sstevel@tonic-gate     private boolean isKeyword = false;
687c478bd9Sstevel@tonic-gate 
697c478bd9Sstevel@tonic-gate     /**
707c478bd9Sstevel@tonic-gate      * Return the attribute's id.
717c478bd9Sstevel@tonic-gate      *
727c478bd9Sstevel@tonic-gate      * @return A String with the attribute's id.
737c478bd9Sstevel@tonic-gate      */
747c478bd9Sstevel@tonic-gate 
getId()757c478bd9Sstevel@tonic-gate     final public String getId() {
767c478bd9Sstevel@tonic-gate 	return id;
777c478bd9Sstevel@tonic-gate     }
787c478bd9Sstevel@tonic-gate 
797c478bd9Sstevel@tonic-gate     /**
807c478bd9Sstevel@tonic-gate      * Return the fully qualified Java type of the attribute. SLP types
817c478bd9Sstevel@tonic-gate      * are translated into Java types as follows:
827c478bd9Sstevel@tonic-gate      *
837c478bd9Sstevel@tonic-gate      *	STRING		java.lang.String
847c478bd9Sstevel@tonic-gate      *	INTEGER		java.lang.Integer
857c478bd9Sstevel@tonic-gate      *	BOOLEAN		java.lang.Boolean
867c478bd9Sstevel@tonic-gate      *	OPAQUE		[B (i.e. array of byte, byte[]);
877c478bd9Sstevel@tonic-gate      *	KEYWORD		null string, ""
887c478bd9Sstevel@tonic-gate      *
897c478bd9Sstevel@tonic-gate      * @return A String containing the Java type name for the attribute values.
907c478bd9Sstevel@tonic-gate      */
917c478bd9Sstevel@tonic-gate 
getValueType()927c478bd9Sstevel@tonic-gate     final public String getValueType() {
937c478bd9Sstevel@tonic-gate 	return valueType;
947c478bd9Sstevel@tonic-gate     }
957c478bd9Sstevel@tonic-gate 
967c478bd9Sstevel@tonic-gate     /**
977c478bd9Sstevel@tonic-gate      * Return attribute's help text.
987c478bd9Sstevel@tonic-gate      *
997c478bd9Sstevel@tonic-gate      * @return A String containing the attribute's help text.
1007c478bd9Sstevel@tonic-gate      */
1017c478bd9Sstevel@tonic-gate 
getDescription()1027c478bd9Sstevel@tonic-gate     final public String getDescription() {
1037c478bd9Sstevel@tonic-gate 	return description;
1047c478bd9Sstevel@tonic-gate     }
1057c478bd9Sstevel@tonic-gate 
1067c478bd9Sstevel@tonic-gate     /**
107*55fea89dSDan Cross      * Return an Enumeration of allowed values for the attribute type.
1087c478bd9Sstevel@tonic-gate      * For keyword attributes returns null. For no allowed values
1097c478bd9Sstevel@tonic-gate      * (i.e. unrestricted) returns an empty Enumeration. Small memory
1107c478bd9Sstevel@tonic-gate      * implementations may want to parse values on demand rather
1117c478bd9Sstevel@tonic-gate      * than at the time the descriptor is created.
1127c478bd9Sstevel@tonic-gate      *
1137c478bd9Sstevel@tonic-gate      * @return An Enumeration of allowed values for the attribute or
1147c478bd9Sstevel@tonic-gate      *         null if the attribute is keyword.
1157c478bd9Sstevel@tonic-gate      */
1167c478bd9Sstevel@tonic-gate 
getAllowedValues()1177c478bd9Sstevel@tonic-gate     final public Enumeration getAllowedValues() {
118*55fea89dSDan Cross 
1197c478bd9Sstevel@tonic-gate 	if (getIsKeyword()) {
1207c478bd9Sstevel@tonic-gate 	    return null;
1217c478bd9Sstevel@tonic-gate 	} else {
1227c478bd9Sstevel@tonic-gate 	    return allowedValues.elements();
1237c478bd9Sstevel@tonic-gate 	}
1247c478bd9Sstevel@tonic-gate     }
1257c478bd9Sstevel@tonic-gate 
1267c478bd9Sstevel@tonic-gate 
1277c478bd9Sstevel@tonic-gate     /**
128*55fea89dSDan Cross      * Return an Enumeration of default values for the attribute type.
1297c478bd9Sstevel@tonic-gate      * For keyword attributes returns null. For no allowed values
1307c478bd9Sstevel@tonic-gate      * (i.e. unrestricted) returns an empty Enumeration. Small memory
1317c478bd9Sstevel@tonic-gate      * implementations may want to parse values on demand rather
1327c478bd9Sstevel@tonic-gate      * than at the time the descriptor is created.
1337c478bd9Sstevel@tonic-gate      *
1347c478bd9Sstevel@tonic-gate      * @return An Enumeration of default values for the attribute or
1357c478bd9Sstevel@tonic-gate      *	      null if the attribute is keyword.
1367c478bd9Sstevel@tonic-gate      */
1377c478bd9Sstevel@tonic-gate 
getDefaultValues()1387c478bd9Sstevel@tonic-gate     final public Enumeration getDefaultValues() {
1397c478bd9Sstevel@tonic-gate 
1407c478bd9Sstevel@tonic-gate 	if (getIsKeyword()) {
1417c478bd9Sstevel@tonic-gate 	    return null;
1427c478bd9Sstevel@tonic-gate 	} else {
1437c478bd9Sstevel@tonic-gate 	    return defaultValues.elements();
1447c478bd9Sstevel@tonic-gate 	}
1457c478bd9Sstevel@tonic-gate     }
1467c478bd9Sstevel@tonic-gate 
1477c478bd9Sstevel@tonic-gate     /**
1487c478bd9Sstevel@tonic-gate      * Returns true if the "M" flag is set.
1497c478bd9Sstevel@tonic-gate      *
1507c478bd9Sstevel@tonic-gate      * @return True if the "M" flag is set.
1517c478bd9Sstevel@tonic-gate      */
1527c478bd9Sstevel@tonic-gate 
getIsMultivalued()1537c478bd9Sstevel@tonic-gate     final public boolean getIsMultivalued() {
1547c478bd9Sstevel@tonic-gate 	return isMultivalued;
1557c478bd9Sstevel@tonic-gate     }
1567c478bd9Sstevel@tonic-gate 
1577c478bd9Sstevel@tonic-gate     /**
1587c478bd9Sstevel@tonic-gate      * Returns true if the "O" flag is set.
1597c478bd9Sstevel@tonic-gate      *
1607c478bd9Sstevel@tonic-gate      * @return True if the "O" flag is set.
1617c478bd9Sstevel@tonic-gate      */
1627c478bd9Sstevel@tonic-gate 
getIsOptional()1637c478bd9Sstevel@tonic-gate     final public boolean getIsOptional() {
1647c478bd9Sstevel@tonic-gate 	return isOptional;
1657c478bd9Sstevel@tonic-gate     }
1667c478bd9Sstevel@tonic-gate 
1677c478bd9Sstevel@tonic-gate     /**
1687c478bd9Sstevel@tonic-gate      * Returns true if the "X" flag is set.
1697c478bd9Sstevel@tonic-gate      *
1707c478bd9Sstevel@tonic-gate      * @return True if the "X" flag is set.
1717c478bd9Sstevel@tonic-gate      */
1727c478bd9Sstevel@tonic-gate 
getRequiresExplicitMatch()1737c478bd9Sstevel@tonic-gate     final public boolean getRequiresExplicitMatch() {
1747c478bd9Sstevel@tonic-gate 	return requiresExplicitMatch;
1757c478bd9Sstevel@tonic-gate     }
1767c478bd9Sstevel@tonic-gate 
1777c478bd9Sstevel@tonic-gate     /**
1787c478bd9Sstevel@tonic-gate      * Returns true if the "L" flag is set.
1797c478bd9Sstevel@tonic-gate      *
1807c478bd9Sstevel@tonic-gate      * @return True if the "L" flag is set.
1817c478bd9Sstevel@tonic-gate      */
1827c478bd9Sstevel@tonic-gate 
getIsLiteral()1837c478bd9Sstevel@tonic-gate     final public boolean getIsLiteral() {
1847c478bd9Sstevel@tonic-gate 	return isLiteral;
1857c478bd9Sstevel@tonic-gate     }
1867c478bd9Sstevel@tonic-gate 
1877c478bd9Sstevel@tonic-gate     /**
1887c478bd9Sstevel@tonic-gate      * Returns true if the attribute is a keyword attribute.
1897c478bd9Sstevel@tonic-gate      *
1907c478bd9Sstevel@tonic-gate      * @return True if the attribute is a keyword attribute
1917c478bd9Sstevel@tonic-gate      */
1927c478bd9Sstevel@tonic-gate 
getIsKeyword()1937c478bd9Sstevel@tonic-gate     final public boolean getIsKeyword() {
1947c478bd9Sstevel@tonic-gate 	return isKeyword;
1957c478bd9Sstevel@tonic-gate     }
1967c478bd9Sstevel@tonic-gate 
1977c478bd9Sstevel@tonic-gate     //
1987c478bd9Sstevel@tonic-gate     // Package private interface for setting properties.
1997c478bd9Sstevel@tonic-gate     //
2007c478bd9Sstevel@tonic-gate 
2017c478bd9Sstevel@tonic-gate     /**
2027c478bd9Sstevel@tonic-gate      * Set the attribute's id.
2037c478bd9Sstevel@tonic-gate      *
2047c478bd9Sstevel@tonic-gate      * @param nid New id string
2057c478bd9Sstevel@tonic-gate      */
2067c478bd9Sstevel@tonic-gate 
setId(String nid)2077c478bd9Sstevel@tonic-gate     void setId(String nid) {
2087c478bd9Sstevel@tonic-gate 	id = nid;
2097c478bd9Sstevel@tonic-gate     }
2107c478bd9Sstevel@tonic-gate 
2117c478bd9Sstevel@tonic-gate     /**
2127c478bd9Sstevel@tonic-gate      * Set the fully qualified Java type of the attribute. We don't check
2137c478bd9Sstevel@tonic-gate      * the argument here, assuming that the caller has taken care of it.
2147c478bd9Sstevel@tonic-gate      *
2157c478bd9Sstevel@tonic-gate      * @param nvt New value type.
2167c478bd9Sstevel@tonic-gate      */
2177c478bd9Sstevel@tonic-gate 
setValueType(String nvt)2187c478bd9Sstevel@tonic-gate     void setValueType(String nvt) {
2197c478bd9Sstevel@tonic-gate 	valueType = nvt;
2207c478bd9Sstevel@tonic-gate     }
2217c478bd9Sstevel@tonic-gate 
2227c478bd9Sstevel@tonic-gate     /**
2237c478bd9Sstevel@tonic-gate      * Set attribute's help text.
2247c478bd9Sstevel@tonic-gate      *
2257c478bd9Sstevel@tonic-gate      * @param ndes A String containing the attribute's help text.
2267c478bd9Sstevel@tonic-gate      */
2277c478bd9Sstevel@tonic-gate 
setDescription(String ndes)2287c478bd9Sstevel@tonic-gate     void setDescription(String ndes) {
2297c478bd9Sstevel@tonic-gate 	description = ndes;
2307c478bd9Sstevel@tonic-gate     }
2317c478bd9Sstevel@tonic-gate 
2327c478bd9Sstevel@tonic-gate     /**
2337c478bd9Sstevel@tonic-gate      * Set the allowed values for an attribute.
2347c478bd9Sstevel@tonic-gate      *
2357c478bd9Sstevel@tonic-gate      * @param nnv A vector of allowed values for the attribute.
2367c478bd9Sstevel@tonic-gate      */
2377c478bd9Sstevel@tonic-gate 
setAllowedValues(Vector nnv)2387c478bd9Sstevel@tonic-gate     void setAllowedValues(Vector nnv) {
2397c478bd9Sstevel@tonic-gate 	allowedValues = nnv;
2407c478bd9Sstevel@tonic-gate     }
2417c478bd9Sstevel@tonic-gate 
2427c478bd9Sstevel@tonic-gate 
2437c478bd9Sstevel@tonic-gate     /**
2447c478bd9Sstevel@tonic-gate      * Set the default values for an attribute.
2457c478bd9Sstevel@tonic-gate      *
2467c478bd9Sstevel@tonic-gate      * @param nnv A vector of default values for the attribute.
2477c478bd9Sstevel@tonic-gate      */
2487c478bd9Sstevel@tonic-gate 
setDefaultValues(Vector nnv)2497c478bd9Sstevel@tonic-gate     void setDefaultValues(Vector nnv) {
2507c478bd9Sstevel@tonic-gate 	defaultValues = nnv;
2517c478bd9Sstevel@tonic-gate     }
2527c478bd9Sstevel@tonic-gate 
2537c478bd9Sstevel@tonic-gate     /**
2547c478bd9Sstevel@tonic-gate      * Set the isMultivalued flag.
2557c478bd9Sstevel@tonic-gate      *
2567c478bd9Sstevel@tonic-gate      * @param flag New multivalued flag.
2577c478bd9Sstevel@tonic-gate      */
2587c478bd9Sstevel@tonic-gate 
setIsMultivalued(boolean flag)2597c478bd9Sstevel@tonic-gate     void setIsMultivalued(boolean flag) {
2607c478bd9Sstevel@tonic-gate 	isMultivalued = flag;
2617c478bd9Sstevel@tonic-gate     }
2627c478bd9Sstevel@tonic-gate 
2637c478bd9Sstevel@tonic-gate     /**
2647c478bd9Sstevel@tonic-gate      * Set the isOptional flag.
2657c478bd9Sstevel@tonic-gate      *
2667c478bd9Sstevel@tonic-gate      * @param flag New optional flag.
2677c478bd9Sstevel@tonic-gate      */
2687c478bd9Sstevel@tonic-gate 
setIsOptional(boolean flag)2697c478bd9Sstevel@tonic-gate     void setIsOptional(boolean flag) {
2707c478bd9Sstevel@tonic-gate 	isOptional = flag;
2717c478bd9Sstevel@tonic-gate     }
2727c478bd9Sstevel@tonic-gate 
2737c478bd9Sstevel@tonic-gate     /**
2747c478bd9Sstevel@tonic-gate      * Set the requiresExplicitMatch flag.
2757c478bd9Sstevel@tonic-gate      *
2767c478bd9Sstevel@tonic-gate      * @param flag New explicit match flag.
2777c478bd9Sstevel@tonic-gate      */
2787c478bd9Sstevel@tonic-gate 
setRequiresExplicitMatch(boolean flag)2797c478bd9Sstevel@tonic-gate     void setRequiresExplicitMatch(boolean flag) {
2807c478bd9Sstevel@tonic-gate 	requiresExplicitMatch = flag;
2817c478bd9Sstevel@tonic-gate     }
2827c478bd9Sstevel@tonic-gate 
2837c478bd9Sstevel@tonic-gate     /**
2847c478bd9Sstevel@tonic-gate      * Set the isLiteral flag.
2857c478bd9Sstevel@tonic-gate      *
2867c478bd9Sstevel@tonic-gate      * @param flag New literal flag.
2877c478bd9Sstevel@tonic-gate      */
2887c478bd9Sstevel@tonic-gate 
setIsLiteral(boolean flag)2897c478bd9Sstevel@tonic-gate     void setIsLiteral(boolean flag) {
2907c478bd9Sstevel@tonic-gate 	isLiteral = flag;
2917c478bd9Sstevel@tonic-gate     }
2927c478bd9Sstevel@tonic-gate 
2937c478bd9Sstevel@tonic-gate     /**
2947c478bd9Sstevel@tonic-gate      * Set the keyword attribute flag.
2957c478bd9Sstevel@tonic-gate      *
2967c478bd9Sstevel@tonic-gate      * @param flag New keyword attribute flag.
2977c478bd9Sstevel@tonic-gate      */
2987c478bd9Sstevel@tonic-gate 
setIsKeyword(boolean flag)2997c478bd9Sstevel@tonic-gate     void setIsKeyword(boolean flag) {
3007c478bd9Sstevel@tonic-gate 	isKeyword = flag;
3017c478bd9Sstevel@tonic-gate     }
3027c478bd9Sstevel@tonic-gate 
3037c478bd9Sstevel@tonic-gate     /**
3047c478bd9Sstevel@tonic-gate      * Format a string with the id and all the fields.
3057c478bd9Sstevel@tonic-gate      *
3067c478bd9Sstevel@tonic-gate      */
3077c478bd9Sstevel@tonic-gate 
toString()3087c478bd9Sstevel@tonic-gate     public String toString() {
3097c478bd9Sstevel@tonic-gate 
3107c478bd9Sstevel@tonic-gate 	String ret = "";
3117c478bd9Sstevel@tonic-gate 
3127c478bd9Sstevel@tonic-gate 	ret += "\nid:" + id + "\n";
3137c478bd9Sstevel@tonic-gate 	ret += "valueType:" + valueType + "\n";
3147c478bd9Sstevel@tonic-gate 	ret += "description:" + description + "\n";
315*55fea89dSDan Cross 	ret +=
316*55fea89dSDan Cross 	    "defaultValues:" +
317*55fea89dSDan Cross 	    (defaultValues == null ? "<null>":
3187c478bd9Sstevel@tonic-gate 	    (valueType.equals(JAVA_OPAQUE_TYPE) ?
319*55fea89dSDan Cross 	    formatByteArrays(defaultValues) : defaultValues.toString())) +
3207c478bd9Sstevel@tonic-gate 	    "\n";
321*55fea89dSDan Cross 	ret +=
322*55fea89dSDan Cross 	    "allowedValues:" +
323*55fea89dSDan Cross 	    (allowedValues == null ? "<null>":
3247c478bd9Sstevel@tonic-gate 	    (valueType.equals(JAVA_OPAQUE_TYPE) ?
325*55fea89dSDan Cross 	    formatByteArrays(allowedValues) : allowedValues.toString())) +
3267c478bd9Sstevel@tonic-gate 	    "\n";
3277c478bd9Sstevel@tonic-gate 	ret += "isMultivalued:" + (isMultivalued ? "true":"false") + "\n";
3287c478bd9Sstevel@tonic-gate 	ret += "isOptional:" + (isOptional ? "true":"false") + "\n";
3297c478bd9Sstevel@tonic-gate 	ret += "requiresExplicitMatch:" +
3307c478bd9Sstevel@tonic-gate 	    (requiresExplicitMatch ? "true":"false") + "\n";
3317c478bd9Sstevel@tonic-gate 	ret += "isLiteral:" + (isLiteral ? "true":"false") + "\n";
3327c478bd9Sstevel@tonic-gate 	ret += "isKeyword:" + (isKeyword ? "true":"false") + "\n\n";
3337c478bd9Sstevel@tonic-gate 
3347c478bd9Sstevel@tonic-gate 	return ret;
3357c478bd9Sstevel@tonic-gate     }
3367c478bd9Sstevel@tonic-gate 
3377c478bd9Sstevel@tonic-gate     // Formats an array of bytes for opaque, rather than just the address.
3387c478bd9Sstevel@tonic-gate 
formatByteArrays(Vector arrays)3397c478bd9Sstevel@tonic-gate     private String formatByteArrays(Vector arrays) {
3407c478bd9Sstevel@tonic-gate 	int i, n = arrays.size();
3417c478bd9Sstevel@tonic-gate 	StringBuffer ret = new StringBuffer();
3427c478bd9Sstevel@tonic-gate 
3437c478bd9Sstevel@tonic-gate 	ret.append("[");
344*55fea89dSDan Cross 
3457c478bd9Sstevel@tonic-gate 	for (i = 0; i < n; i++) {
3467c478bd9Sstevel@tonic-gate 	    byte array[] = (byte[])arrays.elementAt(i);
3477c478bd9Sstevel@tonic-gate 
3487c478bd9Sstevel@tonic-gate 	    ret.append("{ ");
3497c478bd9Sstevel@tonic-gate 
3507c478bd9Sstevel@tonic-gate 	    int j, m = array.length;
3517c478bd9Sstevel@tonic-gate 
3527c478bd9Sstevel@tonic-gate 	    for (j = 0; j < m; j++) {
3537c478bd9Sstevel@tonic-gate 		ret.append("0x");
3547c478bd9Sstevel@tonic-gate 		ret.append(Integer.toHexString((int)array[j]&0xFF));
3557c478bd9Sstevel@tonic-gate 		ret.append(j == m - 1 ? " } " : ",");
3567c478bd9Sstevel@tonic-gate 	    }
3577c478bd9Sstevel@tonic-gate 
3587c478bd9Sstevel@tonic-gate 	    ret.append(i == n - 1 ? "":" , ");
3597c478bd9Sstevel@tonic-gate 	}
3607c478bd9Sstevel@tonic-gate 
3617c478bd9Sstevel@tonic-gate 	ret.append("]");
3627c478bd9Sstevel@tonic-gate 
3637c478bd9Sstevel@tonic-gate 	return ret.toString();
3647c478bd9Sstevel@tonic-gate     }
3657c478bd9Sstevel@tonic-gate 
3667c478bd9Sstevel@tonic-gate }
367