Search code examples
javaarraysstringinputstream

How to convert a String[] array to InputStream in Java


I have a String[] array and I need to convert it to InputStream.

I've seen Byte[] -> InputStream and String -> InputStream, but not this. Any tips?


Solution

  • You can construct a merged String with some separator and then to byte[] and then to ByteArrayInputStream.

    Here's a way to convert a String to InputStream in Java.