@@ -38,8 +38,8 @@ public class StringUtils {
3838 * byte array.
3939 *
4040 * @param string
41- * the String to encode
42- * @return encoded bytes
41+ * the String to encode, may be <code>null</code>
42+ * @return encoded bytes, or <code>null</code> if the input string was <code>null</code>
4343 * @throws IllegalStateException
4444 * Thrown when the charset is missing, which should be never according the the Java specification.
4545 * @see <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
@@ -54,8 +54,8 @@ public static byte[] getBytesIso8859_1(String string) {
5454 * array.
5555 *
5656 * @param string
57- * the String to encode
58- * @return encoded bytes
57+ * the String to encode, may be <code>null</code>
58+ * @return encoded bytes, or <code>null</code> if the input string was <code>null</code>
5959 * @throws IllegalStateException
6060 * Thrown when the charset is missing, which should be never according the the Java specification.
6161 * @see <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
@@ -70,8 +70,8 @@ public static byte[] getBytesUsAscii(String string) {
7070 * array.
7171 *
7272 * @param string
73- * the String to encode
74- * @return encoded bytes
73+ * the String to encode, may be <code>null</code>
74+ * @return encoded bytes, or <code>null</code> if the input string was <code>null</code>
7575 * @throws IllegalStateException
7676 * Thrown when the charset is missing, which should be never according the the Java specification.
7777 * @see <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
@@ -86,8 +86,8 @@ public static byte[] getBytesUtf16(String string) {
8686 * array.
8787 *
8888 * @param string
89- * the String to encode
90- * @return encoded bytes
89+ * the String to encode, may be <code>null</code>
90+ * @return encoded bytes, or <code>null</code> if the input string was <code>null</code>
9191 * @throws IllegalStateException
9292 * Thrown when the charset is missing, which should be never according the the Java specification.
9393 * @see <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
@@ -102,8 +102,8 @@ public static byte[] getBytesUtf16Be(String string) {
102102 * array.
103103 *
104104 * @param string
105- * the String to encode
106- * @return encoded bytes
105+ * the String to encode, may be <code>null</code>
106+ * @return encoded bytes, or <code>null</code> if the input string was <code>null</code>
107107 * @throws IllegalStateException
108108 * Thrown when the charset is missing, which should be never according the the Java specification.
109109 * @see <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
@@ -118,8 +118,8 @@ public static byte[] getBytesUtf16Le(String string) {
118118 * array.
119119 *
120120 * @param string
121- * the String to encode
122- * @return encoded bytes
121+ * the String to encode, may be <code>null</code>
122+ * @return encoded bytes, or <code>null</code> if the input string was <code>null</code>
123123 * @throws IllegalStateException
124124 * Thrown when the charset is missing, which should be never according the the Java specification.
125125 * @see <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
@@ -138,10 +138,10 @@ public static byte[] getBytesUtf8(String string) {
138138 * </p>
139139 *
140140 * @param string
141- * the String to encode
141+ * the String to encode, may be <code>null</code>
142142 * @param charsetName
143143 * The name of a required {@link java.nio.charset.Charset}
144- * @return encoded bytes
144+ * @return encoded bytes, or <code>null</code> if the input string was <code>null</code>
145145 * @throws IllegalStateException
146146 * Thrown when a {@link UnsupportedEncodingException} is caught, which should never happen for a
147147 * required charset name.
@@ -171,10 +171,11 @@ private static IllegalStateException newIllegalStateException(String charsetName
171171 * </p>
172172 *
173173 * @param bytes
174- * The bytes to be decoded into characters
174+ * The bytes to be decoded into characters, may be <code>null</code>
175175 * @param charsetName
176176 * The name of a required {@link java.nio.charset.Charset}
177- * @return A new <code>String</code> decoded from the specified array of bytes using the given charset.
177+ * @return A new <code>String</code> decoded from the specified array of bytes using the given charset,
178+ * or <code>null</code> if the input byte arrray was <code>null</code>.
178179 * @throws IllegalStateException
179180 * Thrown when a {@link UnsupportedEncodingException} is caught, which should never happen for a
180181 * required charset name.
@@ -196,8 +197,9 @@ public static String newString(byte[] bytes, String charsetName) {
196197 * Constructs a new <code>String</code> by decoding the specified array of bytes using the ISO-8859-1 charset.
197198 *
198199 * @param bytes
199- * The bytes to be decoded into characters
200- * @return A new <code>String</code> decoded from the specified array of bytes using the given charset.
200+ * The bytes to be decoded into characters, may be <code>null</code>
201+ * @return A new <code>String</code> decoded from the specified array of bytes using the ISO-8859-1 charset,
202+ * or <code>null</code> if the input byte array was <code>null</code>.
201203 * @throws IllegalStateException
202204 * Thrown when a {@link UnsupportedEncodingException} is caught, which should never happen since the
203205 * charset is required.
@@ -211,7 +213,8 @@ public static String newStringIso8859_1(byte[] bytes) {
211213 *
212214 * @param bytes
213215 * The bytes to be decoded into characters
214- * @return A new <code>String</code> decoded from the specified array of bytes using the given charset.
216+ * @return A new <code>String</code> decoded from the specified array of bytes using the US-ASCII charset,
217+ * or <code>null</code> if the input byte array was <code>null</code>.
215218 * @throws IllegalStateException
216219 * Thrown when a {@link UnsupportedEncodingException} is caught, which should never happen since the
217220 * charset is required.
@@ -225,7 +228,8 @@ public static String newStringUsAscii(byte[] bytes) {
225228 *
226229 * @param bytes
227230 * The bytes to be decoded into characters
228- * @return A new <code>String</code> decoded from the specified array of bytes using the given charset.
231+ * @return A new <code>String</code> decoded from the specified array of bytes using the UTF-16 charset
232+ * or <code>null</code> if the input byte array was <code>null</code>.
229233 * @throws IllegalStateException
230234 * Thrown when a {@link UnsupportedEncodingException} is caught, which should never happen since the
231235 * charset is required.
@@ -239,7 +243,8 @@ public static String newStringUtf16(byte[] bytes) {
239243 *
240244 * @param bytes
241245 * The bytes to be decoded into characters
242- * @return A new <code>String</code> decoded from the specified array of bytes using the given charset.
246+ * @return A new <code>String</code> decoded from the specified array of bytes using the UTF-16BE charset,
247+ * or <code>null</code> if the input byte array was <code>null</code>.
243248 * @throws IllegalStateException
244249 * Thrown when a {@link UnsupportedEncodingException} is caught, which should never happen since the
245250 * charset is required.
@@ -253,7 +258,8 @@ public static String newStringUtf16Be(byte[] bytes) {
253258 *
254259 * @param bytes
255260 * The bytes to be decoded into characters
256- * @return A new <code>String</code> decoded from the specified array of bytes using the given charset.
261+ * @return A new <code>String</code> decoded from the specified array of bytes using the UTF-16LE charset,
262+ * or <code>null</code> if the input byte array was <code>null</code>.
257263 * @throws IllegalStateException
258264 * Thrown when a {@link UnsupportedEncodingException} is caught, which should never happen since the
259265 * charset is required.
@@ -267,7 +273,8 @@ public static String newStringUtf16Le(byte[] bytes) {
267273 *
268274 * @param bytes
269275 * The bytes to be decoded into characters
270- * @return A new <code>String</code> decoded from the specified array of bytes using the given charset.
276+ * @return A new <code>String</code> decoded from the specified array of bytes using the UTF-8 charset,
277+ * or <code>null</code> if the input byte array was <code>null</code>.
271278 * @throws IllegalStateException
272279 * Thrown when a {@link UnsupportedEncodingException} is caught, which should never happen since the
273280 * charset is required.
0 commit comments