code: @Override
  	public int read(byte[] b, int off, int len) throws IOException
      {
          if (len == 0)
              return 0;
          
          int totalRead = 0;
          do
          {
              int amount = readBufferedOrAvailable(b,off+totalRead,len-totalRead);
              if (amount <= 0)
                  return (totalRead == 0) ? amount : totalRead;
              totalRead += amount;
              
              // Did we get enough ?
              if (totalRead >= len)
                  break;
          }
          while (in.available() > 0);
          
          return totalRead;
      }
docs: /*
  (non-Javadoc)
  @see java.io.FilterInputStream#read(byte[], int, int)