// Since InputStream has only one abstract method, // it is easy to create an empty stream by an anonymous subclass // https://stackoverflow.com/questions/49264502/how-to-represent-an-empty-inputstream InputStream empty = new InputStream() { @Override public int read() { return -1; // end of stream } };