code: public static long eatInputStream(InputStream is)
  	{
  		try
  		{
  			long eaten = 0;
  
  			try
  			{
  				Thread.sleep(STREAM_SLEEP_TIME);
  			}
  			catch (InterruptedException e)
  			{
  				// ignore
  			}
  
  			int avail = Math.min(is.available(), CHUNKSIZE);
  			byte[] eatingArray = new byte[CHUNKSIZE];
  			while (avail > 0)
  			{
  				is.read(eatingArray, 0, avail);
  				eaten += avail;
  
  				if (avail < CHUNKSIZE)
  				{ // If the buffer wasn't full, wait a short amount of time to let it fill up
  					if (STREAM_SLEEP_TIME != 0)
  						try
  						{
  							Thread.sleep(STREAM_SLEEP_TIME);
  						}
  						catch (InterruptedException e)
  						{
  							// ignore
  						}
  				}
  				avail = Math.min(is.available(), CHUNKSIZE);
  			}
  
  			return eaten;
  		}
  		catch (IOException e)
  		{
  			log.error(e.getMessage(), e);
  			return -1;
  		}
  	}
docs: Eats an inputstream, discarding its contents
  
  @param is
  InputStream The input stream to read to the end of
  
  @return long The size of the stream