* UTF-8.
*
* @param str
- * the string to transform into bytes
+ * the {@link String} to transform into bytes
* @return the content in bytes
*/
static public byte[] bytes(String str) {
return null;
}
}
+
+ /**
+ * Return the bytes array representation of the given {@link String} in
+ * UTF-8.
+ *
+ * @param strs
+ * the {@link String}s to transform into bytes
+ * @return the content in bytes
+ */
+ static public byte[][] bytes(String[] strs) {
+ try {
+ byte[][] bytes = new byte[strs.length][];
+ for (int i = 0; i < strs.length; i++) {
+ bytes[i] = strs[i].getBytes("UTF-8");
+ }
+ return bytes;
+ } catch (UnsupportedEncodingException e) {
+ // All conforming JVM must support UTF-8
+ e.printStackTrace();
+ return null;
+ }
+ }
}