1

With Apache Commons it is very simple to convert InputStream to byte[],

static byte[] toByteArray(InputStream input)

but I can't find the opposite method. What's the most popular/straightforward way of converting array of bytes to InputStream object?

Thanks in advance.

1 Answer 1

8

Take a look at ByteArrayInputStream

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks! I started looking in Apache Commons and that was a mistake :-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.