2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License (the "License"). 2N/A * You may not use this file except in compliance with the License. 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 2N/A * If applicable, add the following below this CDDL HEADER, with the 2N/A * fields enclosed by brackets "[]" replaced with your own identifying 2N/A * information: Portions Copyright [yyyy] [name of copyright owner] 2N/A * Copyright (c) 1999 by Sun Microsystems, Inc. 2N/A * All rights reserved. 2N/A// Author: James Kempf 2N/A// Created On: Fri Oct 9 19:18:17 1998 2N/A// Last Modified By: James Kempf 2N/A// Last Modified On: Sat Oct 24 13:17:58 1998 2N/A * Handles attribute string encoding and decoding for SLPv1. 2N/A * @author James Kempf 2N/A // Characters to escape. 2N/A * Handles radix64 string encoding and decoding for SLPv1. 2N/A * @author James Kempf 2N/A * Translates the 6 bit value to the corresponding radix 64 2N/A int i = (
int)(
cin & (
char)
0x00FF);
2N/A }
else if (i <
52) {
2N/A }
else if (i <
62) {
2N/A }
else if (i ==
62) {
2N/A }
else if (i ==
63) {
2N/A * Translates a radix 64 representation to the 64 bit value which 2N/A * corresponds to it. 2N/A char c = (
char)
0xffff;
2N/A if (((
char)i >=
'A') && ((
char)i <=
'Z')) {
2N/A c = (
char)((
char)i -
'A');
2N/A if (((
char)i >=
'a') && ((
char)i <=
'z')) {
2N/A c = (
char)((
char)i -
'a' +(
char)
26);
2N/A if (((
char)i >=
'0') && ((
char)i <=
'9')) {
2N/A c = (
char)((
char)i -
'0' +(
char)
52);
2N/A if ((
char)i ==
'+') {
2N/A if ((
char)i ==
'/') {
2N/A if ((
char)i ==
'=') {
2N/A // format of the encoding is "(###:encoding)" where ### is the length 2N/A // convert a string in the encoding to the buffer format 2N/A break;
// scan till begins 2N/A // get 4 bytes to make 3 with, skipping blanks 2N/A char v[] =
new char[
4];
2N/A for (
int x =
0; x <
4; x++) {
2N/A (
byte) (((
0x3F & v[
0]) <<
2) + ((
0x30 & v[
1]) >>
4));
2N/A (
byte) (((
0x0F & v[
1]) <<
4) + ((
0x3C & v[
2]) >>
2));
2N/A b[
pos++] = (
byte) (((
0x03 & v[
2]) <<
6) + (
0x3F & v[
3]));
2N/A }
// end of conversion loop 2N/A // convert an Opaque to the encoding 2N/A int a[] =
new int[
4];
2N/A for (
int j =
0; j <
4; j++) {
2N/A ((
int) (
0xF0 & (
char)
f1) >>
4);
2N/A a[
2] = ((
int) (
0x0F & (
char)
f1) <<
2) +
2N/A ((
int) (
0xC0 & (
char)
f2) >>
6);
2N/A a[
3] = (
int) (
0x3F & (
char)
f2);
2N/A for (
int j =
0; j <
4; j++) {
2N/A // Create an SLPv1 attribute from a general attribute. 2N/A // Create an SLPv1 attribute from the parenthesized expression, using 2N/A // charCode to decode any encodings. 2N/A // If start and end paren, then parse out assignment. 2N/A // Parse the comma separated list. 2N/A // Convert to objects. 2N/A for (i =
0; i < n; i++) {
2N/A // Need to determine which type to use. 2N/A // Convert Opaque to byte array. 2N/A "assignment_syntax_err",
2N/A // Check to make sure there's no parens. 2N/A "assignment_syntax_err",
2N/A // Unescape the keyword. 2N/A // Duplicate of the one in ServiceLocatioAttribute, except we use our 2N/A // unescapeAttributeString. 2N/A // If it can be converted into an integer, then convert it. 2N/A // Wasn't an integer. Try boolean. 2N/A // Process the string to remove escapes. 2N/A // If it begins with the opaque prefix, treat it as an 2N/A // opaque. Use radix64 parser to convert. 2N/A // Externalize the attribute, using its charCode to encode any reserved 2N/A // Exactly like the one in ServiceLocationAttribute, but use our 2N/A // escapeAttributeString. 2N/A // Escape any characters needing it. 2N/A // Convert to radix 64. 2N/A // Escape an attribute string with the char code. 2N/A for (i =
0; i < n; i++) {
2N/A // Need to check ASCII and LATIN1 to make sure that 2N/A // the character is not outside their range of 2N/A // Unescape attribute string, using charCode for reserved characters. 2N/A for (i =
0; i < n; i++) {
2N/A // Check for invalids. 2N/A // Check for escapes. 2N/A // Check to be sure we've got enough characters left. We need 2N/A // Iterate through numbers, collecting. 2N/A for (i++; i < n; i++) {
2N/A // If the buffer is empty, then throw exception 2N/A // If the last one isn't ";", we've got a problem. 2N/A // OK, now convert to a character and add to buffer.