Converts strings to bytes by casting the chars to bytes. This is a fast way to encode a string as ISO-8859-1/US-ASCII bytes. If multiple strings are provided, their bytes are concatenated. @param strings the strings to convert (containing only ISO-8859-1 chars) @return the byte array
(String... strings)
| 2681 | * @return the byte array |
| 2682 | */ |
| 2683 | public static byte[] getBytes(String... strings) { |
| 2684 | int n = 0; |
| 2685 | for (String s : strings) |
| 2686 | n += s.length(); |
| 2687 | byte[] b = new byte[n]; |
| 2688 | n = 0; |
| 2689 | for (String s : strings) |
| 2690 | for (int i = 0, len = s.length(); i < len; i++) |
| 2691 | b[n++] = (byte)s.charAt(i); |
| 2692 | return b; |
| 2693 | } |
| 2694 | |
| 2695 | /** |
| 2696 | * Transfers data from an input stream to an output stream. |
no outgoing calls
no test coverage detected