code: static public void copyStream(InputStream is, OutputStream os, int transferBufferSize) throws IOException {
  		if( transferBufferSize < 1 ) {
  			throw new IOException("Transfer buffer size can not be smaller than 1");
  		}
  
  		byte[] buffer = new byte[transferBufferSize];
  
  		int bytesRead = is.read(buffer);
  		while( bytesRead >= 0 ) {
  			os.write(buffer, 0, bytesRead);
  
  			bytesRead = is.read(buffer);
  		}
  	}
docs: Copy all the bytes from an input stream to an output stream.
  @param is Stream to read bytes from
  @param os Stream to write bytes to
  @param transferBufferSize Size of buffer used to transfer bytes from
  one stream to the other
  @throws IOException