Read characters into the array passed.
183661
@Override
	public int read(char[] cbuf, int off, int len)
	{
		int n = 0;

		while (pos != max && n < len)
		{
			cbuf[off + n++] = data[pos++];
		}

		return n == 0 ? -1 : n;
	}
508837
@Override
    public double[] read(ScanBuffer buffer) {
        int length = getLength(buffer);
        if (length<0) return null;
        return buffer.getDoubles(length);
    }
1051056
@Override
    public int readInt() {
        final char[] text0 = this.text;
        final int eof = this.limit;
        int currpos = this.position;
        char firstchar = text0[++currpos];
        if (firstchar <= ' ') {
            for (;;) {
                firstchar = text0[++currpos];
                if (firstchar > ' ') break;
            }
        }
        boolean quote = false;
        if (firstchar == '"' || firstchar == '\'') {
            quote = true;
            firstchar = text0[++currpos];
            if (firstchar <= ' ') {
                for (;;) {
                    firstchar = text0[++currpos];
                    if (firstchar > ' ') break;
                }
            }
            if (firstchar == '"' || firstchar == '\'') {
                this.position = currpos;
                return 0;
            }
        }
        int value = 0;
        final boolean negative = firstchar == '-';
        if (!negative) {
            if (firstchar < '0' || firstchar > '9') throw new ConvertException("illegal escape(" + firstchar + ") (position = " + currpos + ") in (" + new String(this.text) + ")");
            value = firstchar - '0';
        }
        for (;;) {
            if (currpos == eof) break;
            char ch = text0[++currpos];
            int val = digits[ch];
            if (quote && val == -3) continue;
            if (val <= -3) break;
            if (val == -1) throw new ConvertException("illegal escape(" + ch + ") (position = " + currpos + ") but '" + ch + "' in (" + new String(this.text) + ")");
            if (val != -2) value = value * 10 + val;
        }
        this.position = currpos - 1;
        return negative ? -value : value;
    }
1232089
private int readChar()
    throws IOException
  {
    Reader readEncoding = _readEncoding;

    if (readEncoding == null)
      return read();
    else {
      if (readEncoding.read(_charBuffer, 0, 1) == 1) {
        return _charBuffer[0];
      }
      else {
        return -1;
      }
    }
  }
98298
private function parseByteArray()
    {
        list(, $length) = unpack('N', $this->buffer);

        try {
            return substr($this->buffer, 4, $length);
        } finally {
            $this->buffer = substr($this->buffer, $length + 4);
        }
    }
589274
private int readExp(CharArr arr, int lim) throws IOException {
    nstate |= HAS_EXPONENT;
    int ch = getChar(); lim--;

    if (ch=='+' || ch=='-') {
      arr.write(ch);
      ch = getChar(); lim--;
    }

    // make sure at least one digit is read.
    if (ch<'0' || ch>'9') {
      throw err("missing exponent number");
    }
    arr.write(ch);

    return readExpDigits(arr,lim);
  }
248836
public void characters(char[] characters, int offset, int length)
        throws SAXException
    {
        if (m_firstTagNotEmitted)
        {
            flush();
        }

        m_handler.characters(characters, offset, length);

    }
109228
@Override
	public int read() throws IOException {
		if (pos >= limit)
			return -1;

		try {
			int c = buf[pos] & 0xff;
			if (c < 0x80) {
				pos++;
			} else if (c < 0xE0) {
				c = (char) ((c & 0x1F) << 6 | buf[pos + 1] & 0x3F);
				pos += 2;
			} else {
				c = (char) ((c & 0x0F) << 12 | (buf[pos + 1] & 0x3F) << 6 | (buf[pos + 2] & 0x3F));
				pos += 3;
			}
			if (pos > limit)
				throw new IOException();
			return c;
		} catch (ArrayIndexOutOfBoundsException e) {
			throw new IOException(e);
		}
	}
132471
private int readExpDigits(CharArr arr, int lim) throws IOException {
    while (--lim>=0) {
      int ch = getChar();
      if (ch>='0' && ch<='9') {
        arr.write(ch);
      } else {
        if (ch!=-1) start--; // back up
        return NUMBER;
      }
    }
    return BIGNUMBER;
  }
652946
@Override
	public int read(char[] cbuf, int off, int len) throws IOException {
		try {
			if (closed) {
				throw new IOException("Attempt to read from a closed stream"); //$NON-NLS-1$
			}
			if (eof) {
				return -1;
			}
			if (curr == null) {
				curr = getNextInputReader();
				if (curr == null) {
					eof = true;
					return -1;
				}
			}
			int size, bytesRead = 0, bytesToRead = len;
			while (!eof && bytesRead < bytesToRead) {
				size = curr
						.read(cbuf, off + bytesRead, bytesToRead - bytesRead);
				if (size == -1) {
					curr.close();
					curr = getNextInputReader();
					if (curr == null) {
						eof = true;
					}
				} else {
					bytesRead += size;
				}
			}
			return bytesRead;
		} catch (IOException e) {
			throw e;
		} catch (Exception e) {
			throw new IOException(e);
		}
	}
869493
@Override
    public float[] read(ScanBuffer buffer) {
        int length = getLength(buffer);
        if (length<0) return null;
        return buffer.getFloats(length);
    }
710095
@SuppressWarnings("unchecked")
    public static List<Character> getAt(char[] array, Collection indices) {
        return primitiveArrayGet(array, indices);
    }
1340396
private byte[] toByteArray(char[] chars, Charset charset) {
        assert chars != null;

        CharBuffer charBuffer = CharBuffer.wrap(chars);
        ByteBuffer byteBuffer = charset.encode(charBuffer);
        byte[] bytes = Arrays.copyOfRange(byteBuffer.array(),
                byteBuffer.position(), byteBuffer.limit());
        Arrays.fill(byteBuffer.array(), (byte) 0); // clear sensitive data
        return bytes;
    }
288991
public int read(char []cbuf, int off, int len)
    throws IOException
  {
    for (int i = 0; i < len; i++) {
      int ch = read();

      if (ch < 0)
        return len;

      cbuf[off + i] = (char) ch;
    }

    return len;
  }
1328356
public int read(char cbuf[], int off, int len) throws IOException {
        int c = 0;
        int count = 0;
        while (count < len && (c = read())!= -1) {
            cbuf[off + count] = (char) c;
            count++;
        }
        return (count == 0 && c == -1) ? -1 : count;
    }
271867
private long readLong(ByteBuf chars, int length) {
        long result = 0;
        for (int i = chars.readerIndex(); i < chars.readerIndex() + length; i++) {
            int digit = ((int)chars.getByte(i) & 0xF);
            for (int j = 0; j < chars.readerIndex() + length-1-i; j++) {
                digit *= 10;
            }
            result += digit;
        }
        chars.readerIndex(chars.readerIndex() + length);
        return result;
    }
967218
@Override
    public int[] read(ScanBuffer buffer) {
        int length = getLength(buffer);
        if (length<0) return null;
        return buffer.getInts(length);
    }