×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Java
Posted by: JM Brun
Added: Aug 9, 2018 1:01 PM
Views: 3352
  1. // Since InputStream has only one abstract method,
  2. // it is easy to create an empty stream by an anonymous subclass
  3. // https://stackoverflow.com/questions/49264502/how-to-represent-an-empty-inputstream
  4.  
  5. InputStream empty = new InputStream() {
  6.     @Override
  7.     public int read() {
  8.         return -1;  // end of stream
  9.     }
  10. };