In my method, I'm saving data from file to an output stream.
For now, it looks like this
public void readFileToOutputStream(Path path, OutputStream os) {
byte[] barr = Files.readAllBytes(path)
os.write(barr);
os.flush();
}
But in this solution, all bytes are loaded into memory, and I want to use buffer to release some of it.
What can I use to supply my reading with buffer?