Checks that the specified number of bytes available for reading.
@param count The number of bytes to check
@return {@code true} if {@code count} bytes are available for reading, otherwise {@code false}
172042
boolean hasReadableBytes(int count) {
        if (count < 0 || count > MAX_COUNT_OF_READABLE_BYTES) {
            throw new IllegalArgumentException("count: " + count
                    + " (expected: 0-" + MAX_COUNT_OF_READABLE_BYTES + ')');
        }
        return hasReadableBits(count << 3);
    }
259212
public int check(TimeUnit timeUnit, long count) {
        
        int pollPeriodMillis = getPollPeriodMillis();
        long startTime = System.currentTimeMillis();
        long expireTime = startTime + timeUnit.toMillis(count);
        int iteration = 0;
        while(true) {
            iteration++;
            try {
                validate();
            } catch (Throwable t) {
                propagateAsError(t);
            }
            
            sleepUntil(startTime + (pollPeriodMillis * iteration));

            if ( System.currentTimeMillis() >= expireTime) {
                break;
            }
        }
        
        return iteration;
    }
330082
public boolean isCollidingWith(Resource that, int count) {
        assert that!=null;
        for(Resource r=that; r!=null; r=r.parent)
            if(this.equals(r) && r.numConcurrentWrite<count)
                return true;
        for(Resource r=this; r!=null; r=r.parent)
            if(that.equals(r) && r.numConcurrentWrite<count)
                return true;
        return false;
    }
1001527
int readBits(final int count) {
        if (count < 0 || count > 32) {
            throw new IllegalArgumentException("count: " + count + " (expected: 0-32 )");
        }
        int bitCount = this.bitCount;
        long bitBuffer = this.bitBuffer;

        if (bitCount < count) {
            long readData;
            int offset;
            switch (in.readableBytes()) {
                case 1: {
                    readData = in.readUnsignedByte();
                    offset = 8;
                    break;
                }
                case 2: {
                    readData = in.readUnsignedShort();
                    offset = 16;
                    break;
                }
                case 3: {
                    readData = in.readUnsignedMedium();
                    offset = 24;
                    break;
                }
                default: {
                    readData = in.readUnsignedInt();
                    offset = 32;
                    break;
                }
            }

            bitBuffer = bitBuffer << offset | readData;
            bitCount += offset;
            this.bitBuffer = bitBuffer;
        }

        this.bitCount = bitCount -= count;
        return (int) (bitBuffer >>> bitCount & (count != 32 ? (1 << count) - 1 : 0xFFFFFFFFL));
    }
168083
public String peek(int count)
	{
		return str.substring(cursor, cursor+Math.min(count, str.length()-cursor));
	}
1233032
def read(self, count):
        

        offset = self.offset
        if self.data:
            avail = len(self.data) - offset
        else:
            avail = 0

        if avail < count:
            raise UnpackException(None, count, avail)

        self.offset = offset + count
        return self.data[offset:self.offset]
1363322
@Restricted(NoExternalUse.class)
    public static void skip(@Nonnull Iterator<?> iterator, int count) {
        if (count < 0) {
            throw new IllegalArgumentException();
        }
        while (iterator.hasNext() && count-- > 0) {
            iterator.next();
        }
    }
143391
func (cb *CountBytes) Count() int {
	cb.mu.Lock()
	defer cb.mu.Unlock()
	return cb.count
}
1033387
public void readBytes (Object to, long offset, int count) throws KryoException {
		int copyCount = Math.min(limit - position, count);
		while (true) {
			unsafe.copyMemory(null, bufferAddress + position, to, offset, copyCount);
			position += copyCount;
			count -= copyCount;
			if (count == 0) break;
			offset += copyCount;
			copyCount = Math.min(count, capacity);
			require(copyCount);
		}
		byteBuffer.position(position);
	}
380364
public static int countLines(InputStream is) throws IOException {
        try {
            byte[] c = new byte[1024];
            int count = 0;
            int readChars = 0;
            boolean empty = true;
            while ((readChars = is.read(c)) != -1) {
                empty = false;
                for (int i = 0; i < readChars; ++i) {
                    if (c[i] == '\n') {
                        ++count;
                    }
                }
            }
            return (count == 0 && !empty) ? 1 : count;
        } finally {
            is.close();
        }


    }
870191
public int doRead(ByteChunk chunk) {
        if (!isNeedToRead()) {
            // Read only once.
            return -1;
        }

        read = true;

        final int readableBytes = content.length();
        chunk.setBytes(content.array(), content.offset(), readableBytes);

        return readableBytes;
    }
1319097
public function stream_read($count)
    {
        $ret = mb_substr($this->data, $this->position, $count);
        $this->position += mb_strlen($ret);

        return $ret;
    }
1355247
public boolean hasNext()
    {
        while (_list.hasMoreTokens() && (_current.length() == 0))
        {
            _current = _list.nextToken();
        }
        return (_current.length() > 0);
    }
811517
def read_bytes(self, count):
        """"""
        if self.pos + count > self.remaining_length:
            return NC.ERR_PROTOCOL, None
        
        ba = bytearray(count)
        for x in xrange(0, count):
            ba[x] = self.payload[self.pos]
            self.pos += 1
        
        return NC.ERR_SUCCESS, ba
1109299
public static int count(final Object array) {

    if (isArray(array)) {
      return Array.getLength(array);
    } else if (array != null) {
      throw new IllegalArgumentException("Given data is not an array.");
    } else {
      return 0;
    }
  }
463730
public Buffer readFrom(InputStream in, long byteCount) throws IOException {
    if (byteCount < 0) throw new IllegalArgumentException("byteCount < 0: " + byteCount);
    readFrom(in, byteCount, false);
    return this;
  }
375491
public int count(T x, T y, int count) {
        if (count < 1)
            throw new IllegalArgumentException("Count must be positive: " + count);
        long index = getIndex(x, y);
        int oldCount = counts.get(index);
        int newCount = count + oldCount;
        counts.put(index, newCount);
        sum += count;
        return newCount;
    }