public static void drain(InputStream inStr) throws IOException {
  byte[] bs=new byte[BUFFER_SIZE];
  while (inStr.read(bs,0,bs.length) >= 0) {
  }
}

public static void drain ( InputStream inStr ) throws IOException { byte [ ] bs = new byte [ BUFFER_SIZE ] ; while ( inStr . read ( bs , 0 , bs . length ) >= 0 ) { } }
read stream till eof is encountered .
