1

I want to get a inputStream source from a file, and put this as a Byte in a ArrayList.

But I didn´t find any thing about this.

Can someone help me?

1
  • 1
    But I didn´t found any thing about this. Read all of this and all of this. Commented Feb 8, 2014 at 22:27

1 Answer 1

2

How about using Files#readAllBytes:

 byte[] bytes = Files.readAllBytes(path);

The conversion to a List<Byte>, if you really need it, can be done with a simple loop.

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

3 Comments

Might be worth adding a note about Arrays.asList(Files.readAllBytes(path)) since he wants an ArrayList.
That would return a List<byte[]> with one element.
But I want the inputStream, because its a file from in e-mail.

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.