Lines 50-66
Link Here
|
50 |
} |
50 |
} |
51 |
return match; |
51 |
return match; |
52 |
} |
52 |
} |
53 |
|
53 |
|
54 |
public static String toString(byte[] data) { |
54 |
public static String toString(byte[] data) { |
55 |
return toString(data,0,data!=null?data.length:0); |
55 |
return toString(data, false); |
56 |
} |
56 |
} |
|
|
57 |
|
58 |
public static String toString(byte[] data, boolean unsigned) { |
59 |
return toString(data, 0, data != null ? data.length : 0, unsigned); |
60 |
} |
57 |
|
61 |
|
58 |
public static String toString(byte[] data, int offset, int length) { |
62 |
public static String toString(byte[] data, int offset, int length) { |
|
|
63 |
return toString(data, offset, length, false); |
64 |
} |
65 |
|
66 |
public static String toString(byte[] data, int offset, int length, boolean unsigned) { |
59 |
StringBuffer buf = new StringBuffer("{"); |
67 |
StringBuffer buf = new StringBuffer("{"); |
60 |
if ( data != null && length > 0 ) { |
68 |
if (data != null && length > 0) { |
61 |
buf.append(data[offset++]); |
69 |
if (unsigned) { |
62 |
for (int i = offset; i < length; i++) { |
70 |
buf.append(data[offset++] & 0xff); |
63 |
buf.append(", ").append(data[i]); |
71 |
for (int i = offset; i < length; i++) { |
|
|
72 |
buf.append(", ").append(data[i] & 0xff); |
73 |
} |
74 |
} else { |
75 |
buf.append(data[offset++]); |
76 |
for (int i = offset; i < length; i++) { |
77 |
buf.append(", ").append(data[i]); |
78 |
} |
64 |
} |
79 |
} |
65 |
} |
80 |
} |
66 |
buf.append("}"); |
81 |
buf.append("}"); |
Lines 203-210
Link Here
|
203 |
return result; |
218 |
return result; |
204 |
} |
219 |
} |
205 |
|
220 |
|
206 |
|
|
|
207 |
|
208 |
public static byte[] convert(String s) { |
221 |
public static byte[] convert(String s) { |
209 |
try { |
222 |
try { |
210 |
return s.getBytes("ISO-8859-1"); |
223 |
return s.getBytes("ISO-8859-1"); |
Lines 213-221
Link Here
|
213 |
return s.getBytes(); |
226 |
return s.getBytes(); |
214 |
} |
227 |
} |
215 |
} |
228 |
} |
|
|
229 |
} |
216 |
|
230 |
|
217 |
|
|
|
218 |
|
219 |
|
220 |
|
221 |
} |