Create ByteArrayInputStream from a String
import java.io.ByteArrayInputStream;
public class Main {
public static void main(String[] argv) throws Exception {
byte[] bytes = "asdf".getBytes("UTF8");
new ByteArrayInputStream(bytes);
}
}
Home
Java Book
Runnable examples
Java Book
Runnable examples
IO ByteArrayInputStream:
- Create ByteArrayInputStream from a String
- Create UTF8 InputStream
- Convert to byte array