Converts a string into a byte array using the specified encoding. @param charset the charset @param content the string to convert @return the String as a byte[]; if the specified encoding is not supported an empty byte[] will be returned
(final String content, final Charset charset)
| 762 | * @return the String as a byte[]; if the specified encoding is not supported an empty byte[] will be returned |
| 763 | */ |
| 764 | public static byte[] toByteArray(final String content, final Charset charset) { |
| 765 | if (content == null || content.isEmpty()) { |
| 766 | return new byte[0]; |
| 767 | } |
| 768 | |
| 769 | return content.getBytes(charset); |
| 770 | } |
| 771 | |
| 772 | /** |
| 773 | * Splits the provided text into an array, using whitespace as the |