Diego Macario
Diego Macario

Reputation: 1230

Create a arraylist of bytes by a inputstream

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?

Upvotes: 1

Views: 475

Answers (1)

assylias
assylias

Reputation: 328873

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.

Upvotes: 2

Related Questions