code: public static void copyStream(InputStream inStream, OutputStream outStream, boolean ignoreErrors)
      {
          byte[] data = new byte[BUFFER];
          int count;
          try {
              while((count = inStream.read(data, 0, BUFFER)) != -1)
              {
                  outStream.write(data, 0, count);
              }
          } catch (IOException e) {
              if (!ignoreErrors)
                  e.printStackTrace();
          }
      }
docs: Copy the input stream to the output stream
  @param inStream
  @param outStream
  @param ignoreErrors