* @throws NullPointerException
	 *             if target is null
	 * @throws ReadOnlyBufferException
	 *             if target is a read only buffer
	 * @since 1.5
	 */
	public int read(CharBuffer target) throws IOException {
		// Determine the number of bytes n that can be transferred
		int targetRemaining = target.remaining();
		int remaining = remaining();
		if (remaining == 0)
			return -1;
		int n = Math.min(remaining, targetRemaining);
		int limit = limit();
		// Set source limit to prevent target overflow
		if (targetRemaining < remaining)
			limit(position() + n);
		try {
			if (n > 0)
				target.put(this);
		} finally {
			limit(limit); // restore real limit
		}
		return n;
	}