code: public byte readByte() throws IOException {
  
  		// buffer depleted ?
  		if (head == tail) {
  			head = 0;
  			// Refill.
  			tail = input.read(buffer, head, bufSize);
  			if (tail == -1) {
  				// no more data available.
  				throw new IOException("No more data is available");
  			}
  		}
  
  		return buffer[head++];
  	}
docs: Reads a byte from the <code>buffer</code>, and refills it as necessary.
  
  @return The next byte from the input stream.
  @throws IOException if there is no more data available.